build(biji-houdaun): 优化配置文件和依赖管理- 移除生产环境中的 MyBatis-Plus 配置- 在开发环境中添加 MyBatis-Plus 配置
- 在生产环境中禁用 Knife4j- 更新 Knife4j 和 springdoc 依赖为可选 -调整开发和生产环境的依赖范围
This commit is contained in:
@@ -87,11 +87,13 @@
|
|||||||
<groupId>com.github.xiaoymin</groupId>
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||||
<version>${knife4j.version}</version>
|
<version>${knife4j.version}</version>
|
||||||
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springdoc</groupId>
|
<groupId>org.springdoc</groupId>
|
||||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||||
<version>2.7.0</version>
|
<version>2.7.0</version>
|
||||||
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- MyBatis Plus -->
|
<!-- MyBatis Plus -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -176,31 +178,33 @@
|
|||||||
|
|
||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
<!-- 开发环境包含Knife4j -->
|
<!-- 开发环境 -->
|
||||||
<profile>
|
<profile>
|
||||||
<id>dev</id>
|
<id>dev</id>
|
||||||
<activation>
|
<activation>
|
||||||
<activeByDefault>true</activeByDefault>
|
<activeByDefault>true</activeByDefault>
|
||||||
</activation>
|
</activation>
|
||||||
|
</profile>
|
||||||
|
|
||||||
|
<!-- 生产环境排除Knife4j和springdoc -->
|
||||||
|
<profile>
|
||||||
|
<id>prod</id>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- Knife4j API 文档 -->
|
<!-- 排除Knife4j API 文档 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.xiaoymin</groupId>
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||||
<version>${knife4j.version}</version>
|
<version>${knife4j.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springdoc</groupId>
|
<groupId>org.springdoc</groupId>
|
||||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||||
<version>2.7.0</version>
|
<version>2.7.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</profile>
|
</profile>
|
||||||
|
|
||||||
<!-- 生产环境不包含Knife4j -->
|
|
||||||
<profile>
|
|
||||||
<id>prod</id>
|
|
||||||
</profile>
|
|
||||||
</profiles>
|
</profiles>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ package com.test.bijihoudaun.config;
|
|||||||
import io.swagger.v3.oas.models.OpenAPI;
|
import io.swagger.v3.oas.models.OpenAPI;
|
||||||
import io.swagger.v3.oas.models.info.Info;
|
import io.swagger.v3.oas.models.info.Info;
|
||||||
import org.springdoc.core.models.GroupedOpenApi;
|
import org.springdoc.core.models.GroupedOpenApi;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Profile;
|
import org.springframework.context.annotation.Profile;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@Profile("!prod") // 只在非生产环境激活
|
@Profile("!prod") // 只在非生产环境激活
|
||||||
|
@ConditionalOnProperty(name = "knife4j.enable", havingValue = "true", matchIfMissing = true)
|
||||||
public class Knife4jConfig {
|
public class Knife4jConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|||||||
@@ -11,3 +11,15 @@ spring:
|
|||||||
hibernate:
|
hibernate:
|
||||||
format_sql: true
|
format_sql: true
|
||||||
dialect: org.hibernate.dialect.SQLiteDialect
|
dialect: org.hibernate.dialect.SQLiteDialect
|
||||||
|
|
||||||
|
|
||||||
|
# MyBatis-Plus??
|
||||||
|
mybatis-plus:
|
||||||
|
mapper-locations: classpath:mapper/*.xml
|
||||||
|
configuration:
|
||||||
|
map-underscore-to-camel-case: true
|
||||||
|
global-config:
|
||||||
|
db-config:
|
||||||
|
logic-delete-field: isDeleted # 全局逻辑删除的实体字段名
|
||||||
|
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
|
||||||
|
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
|
||||||
@@ -10,3 +10,9 @@ spring:
|
|||||||
hibernate:
|
hibernate:
|
||||||
format_sql: false
|
format_sql: false
|
||||||
dialect: org.hibernate.dialect.SQLiteDialect
|
dialect: org.hibernate.dialect.SQLiteDialect
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 禁用Knife4j
|
||||||
|
knife4j:
|
||||||
|
enable: false
|
||||||
@@ -24,16 +24,7 @@ worker:
|
|||||||
datacenter:
|
datacenter:
|
||||||
id: 1
|
id: 1
|
||||||
|
|
||||||
# MyBatis-Plus??
|
|
||||||
mybatis-plus:
|
|
||||||
mapper-locations: classpath:mapper/*.xml
|
|
||||||
configuration:
|
|
||||||
map-underscore-to-camel-case: true
|
|
||||||
global-config:
|
|
||||||
db-config:
|
|
||||||
logic-delete-field: isDeleted # 全局逻辑删除的实体字段名
|
|
||||||
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
|
|
||||||
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
|
|
||||||
|
|
||||||
# JWT 配置
|
# JWT 配置
|
||||||
jwt:
|
jwt:
|
||||||
|
|||||||
Reference in New Issue
Block a user