build(biji-houdaun): 优化配置文件和依赖管理- 移除生产环境中的 MyBatis-Plus 配置- 在开发环境中添加 MyBatis-Plus 配置
- 在生产环境中禁用 Knife4j- 更新 Knife4j 和 springdoc 依赖为可选 -调整开发和生产环境的依赖范围
This commit is contained in:
@@ -87,11 +87,13 @@
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||
<version>${knife4j.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
<version>2.7.0</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- MyBatis Plus -->
|
||||
<dependency>
|
||||
@@ -176,31 +178,33 @@
|
||||
|
||||
|
||||
<profiles>
|
||||
<!-- 开发环境包含Knife4j -->
|
||||
<!-- 开发环境 -->
|
||||
<profile>
|
||||
<id>dev</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
</profile>
|
||||
|
||||
<!-- 生产环境排除Knife4j和springdoc -->
|
||||
<profile>
|
||||
<id>prod</id>
|
||||
<dependencies>
|
||||
<!-- Knife4j API 文档 -->
|
||||
<!-- 排除Knife4j API 文档 -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||
<version>${knife4j.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
<version>2.7.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<!-- 生产环境不包含Knife4j -->
|
||||
<profile>
|
||||
<id>prod</id>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -3,12 +3,14 @@ package com.test.bijihoudaun.config;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import org.springdoc.core.models.GroupedOpenApi;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
|
||||
@Configuration
|
||||
@Profile("!prod") // 只在非生产环境激活
|
||||
@ConditionalOnProperty(name = "knife4j.enable", havingValue = "true", matchIfMissing = true)
|
||||
public class Knife4jConfig {
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -11,3 +11,15 @@ spring:
|
||||
hibernate:
|
||||
format_sql: true
|
||||
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)
|
||||
@@ -9,4 +9,10 @@ spring:
|
||||
properties:
|
||||
hibernate:
|
||||
format_sql: false
|
||||
dialect: org.hibernate.dialect.SQLiteDialect
|
||||
dialect: org.hibernate.dialect.SQLiteDialect
|
||||
|
||||
|
||||
|
||||
# 禁用Knife4j
|
||||
knife4j:
|
||||
enable: false
|
||||
@@ -24,16 +24,7 @@ worker:
|
||||
datacenter:
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user