修改yml文件,大部分配置代码放到参数文件中
This commit is contained in:
parent
3786e6f078
commit
cf81b1f67c
@ -1,42 +1,31 @@
|
||||
# 数据源及mybatis、mybatis-flex配置
|
||||
--- # 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
hikari:
|
||||
# 最大连接池数量
|
||||
maximum-pool-size: 20
|
||||
# 最小空闲线程数量
|
||||
minimum-idle: 10
|
||||
# 配置获取连接等待超时的时间
|
||||
connectionTimeout: 30000
|
||||
# 校验超时时间
|
||||
validationTimeout: 5000
|
||||
# 空闲连接存活最大时间,默认10分钟
|
||||
idleTimeout: 600000
|
||||
# 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认30分钟
|
||||
maxLifetime: 1800000
|
||||
# 连接测试query(配置检测连接是否有效)
|
||||
connectionTestQuery: SELECT 1
|
||||
# 多久检查一次连接的活性
|
||||
keepaliveTime: 30000
|
||||
mybatis-flex:
|
||||
# 搜索指定包别名
|
||||
typeAliasesPackage: com.ruoyi.**.domain
|
||||
# 不支持多包, 如有需要可在注解配置 或 提升扫包等级:com.**.**.mapper
|
||||
mapperPackage: com.ruoyi.**.mapper
|
||||
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||
|
||||
#本部分(Configuration)的配置都为 MyBatis 原生支持的配置,有关配置请参考:https://mybatis.org/mybatis-3/zh/configuration.html#%E8%AE%BE%E7%BD%AE%EF%BC%88settings%EF%BC%89
|
||||
configuration:
|
||||
# 自动驼峰命名规则(camel case)映射
|
||||
mapUnderscoreToCamelCase: true
|
||||
# MyBatis 自动映射策略
|
||||
# NONE:不启用 PARTIAL:只对非嵌套 resultMap 自动映射 FULL:对所有 resultMap 自动映射
|
||||
autoMappingBehavior: FULL
|
||||
# MyBatis 自动映射时未知列或未知属性处理策
|
||||
# NONE:不做处理 WARNING:打印相关警告 FAILING:抛出异常和详细信息
|
||||
autoMappingUnknownColumnBehavior: NONE
|
||||
# 更详细的日志输出 会有性能损耗 org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
# 关闭日志记录 org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||
# 默认日志输出 org.apache.ibatis.logging.slf4j.Slf4jImpl
|
||||
logImpl: org.apache.ibatis.logging.slf4j.Slf4jImpl
|
||||
cacheEnabled: true
|
||||
|
||||
# MyBatis-Flex全局配置
|
||||
global-config:
|
||||
# 是否控制台打印 MyBatis-Flex 的 LOGO 及版本号
|
||||
print-banner: true
|
||||
# 逻辑删除数据存在标记值
|
||||
normal-value-of-logic-delete: 0
|
||||
# 逻辑删除数据存在标记值
|
||||
deleted-value-of-logic-delete: 1
|
||||
|
||||
datasource:
|
||||
# 数据源-1
|
||||
ds1:
|
||||
# 指定为HikariDataSource
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
||||
type: ${spring.datasource.type}
|
||||
# mysql数据库
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# url: jdbc:mysql://localhost:3306/ruoyi-flex?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
|
||||
@ -48,31 +37,10 @@ mybatis-flex:
|
||||
username: postgres
|
||||
password: postgres@369
|
||||
|
||||
hikari:
|
||||
#连接池名
|
||||
pool-name: HikariCP-ds1
|
||||
#最小空闲连接数
|
||||
minimum-idle: 5
|
||||
# 空闲连接存活最大时间,默认10分钟
|
||||
idle-timeout: 600000
|
||||
# 连接池最大连接数,默认是10
|
||||
maximum-pool-size: 10
|
||||
# 此属性控制从池返回的连接的默认自动提交行为,默认值:true
|
||||
auto-commit: true
|
||||
# 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认30分钟
|
||||
max-lifetime: 1800000
|
||||
# 数据库连接超时时间,默认30秒
|
||||
connection-timeout: 30000
|
||||
# 校验超时时间
|
||||
validationTimeout: 5000
|
||||
# 多久检查一次连接的活性
|
||||
keepaliveTime: 30000
|
||||
# 连接测试query
|
||||
connection-test-query: SELECT 1
|
||||
# 数据源-2
|
||||
# # 数据源-2
|
||||
# ds2:
|
||||
# # 指定为HikariDataSource
|
||||
# type: com.zaxxer.hikari.HikariDataSource
|
||||
# type: ${spring.datasource.type}
|
||||
# # mysql数据库
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# url: jdbc:mysql://localhost:3306/ruoyi-flex?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
|
||||
@ -83,28 +51,6 @@ mybatis-flex:
|
||||
## url: jdbc:postgresql://localhost:5432/ruoyi-flex?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
|
||||
## username: postgres
|
||||
## password: postgres@369
|
||||
#
|
||||
# hikari:
|
||||
# #连接池名
|
||||
# pool-name: HikariCP-ds1
|
||||
# #最小空闲连接数
|
||||
# minimum-idle: 5
|
||||
# # 空闲连接存活最大时间,默认10分钟
|
||||
# idle-timeout: 600000
|
||||
# # 连接池最大连接数,默认是10
|
||||
# maximum-pool-size: 10
|
||||
# # 此属性控制从池返回的连接的默认自动提交行为,默认值:true
|
||||
# auto-commit: true
|
||||
# # 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认30分钟
|
||||
# max-lifetime: 1800000
|
||||
# # 数据库连接超时时间,默认30秒
|
||||
# connection-timeout: 30000
|
||||
# # 校验超时时间
|
||||
# validationTimeout: 5000
|
||||
# # 多久检查一次连接的活性
|
||||
# keepaliveTime: 30000
|
||||
# # 连接测试query
|
||||
# connection-test-query: SELECT 1
|
||||
|
||||
# redis 单机配置(单机与集群只能开启一个另一个需要注释掉)
|
||||
spring.data:
|
||||
@ -144,18 +90,6 @@ redisson:
|
||||
# 发布和订阅连接池大小
|
||||
subscriptionConnectionPoolSize: 50
|
||||
|
||||
--- # Actuator 监控端点的配置项
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: '*'
|
||||
endpoint:
|
||||
health:
|
||||
show-details: ALWAYS
|
||||
logfile:
|
||||
external-file: ./logs/ruoyi-monitor.log
|
||||
|
||||
--- # 监控中心客户端配置
|
||||
spring.boot.admin.client:
|
||||
# 增加客户端开关
|
||||
@ -181,5 +115,3 @@ powerjob:
|
||||
enable-test-mode: false
|
||||
max-appended-wf-context-length: 4096
|
||||
max-result-length: 4096
|
||||
|
||||
|
||||
|
@ -1,80 +1,56 @@
|
||||
# 临时文件存储位置 避免临时文件被系统清理报错
|
||||
spring.servlet.multipart.location: /ruoyi/server/temp
|
||||
|
||||
# 数据源及mybatis、mybatis-flex配置
|
||||
--- # 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
hikari:
|
||||
# 最大连接池数量
|
||||
maximum-pool-size: 20
|
||||
# 最小空闲线程数量
|
||||
minimum-idle: 10
|
||||
# 配置获取连接等待超时的时间
|
||||
connectionTimeout: 30000
|
||||
# 校验超时时间
|
||||
validationTimeout: 5000
|
||||
# 空闲连接存活最大时间,默认10分钟
|
||||
idleTimeout: 600000
|
||||
# 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认30分钟
|
||||
maxLifetime: 1800000
|
||||
# 连接测试query(配置检测连接是否有效)
|
||||
connectionTestQuery: SELECT 1
|
||||
# 多久检查一次连接的活性
|
||||
keepaliveTime: 30000
|
||||
mybatis-flex:
|
||||
# 搜索指定包别名
|
||||
typeAliasesPackage: com.ruoyi.**.domain
|
||||
# 不支持多包, 如有需要可在注解配置 或 提升扫包等级:com.**.**.mapper
|
||||
mapperPackage: com.ruoyi.**.mapper
|
||||
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||
cacheEnabled: true
|
||||
|
||||
#本部分(Configuration)的配置都为 MyBatis 原生支持的配置,有关配置请参考:https://mybatis.org/mybatis-3/zh/configuration.html#%E8%AE%BE%E7%BD%AE%EF%BC%88settings%EF%BC%89
|
||||
configuration:
|
||||
# 自动驼峰命名规则(camel case)映射
|
||||
mapUnderscoreToCamelCase: true
|
||||
# MyBatis 自动映射策略
|
||||
# NONE:不启用 PARTIAL:只对非嵌套 resultMap 自动映射 FULL:对所有 resultMap 自动映射
|
||||
autoMappingBehavior: FULL
|
||||
# MyBatis 自动映射时未知列或未知属性处理策
|
||||
# NONE:不做处理 WARNING:打印相关警告 FAILING:抛出异常和详细信息
|
||||
autoMappingUnknownColumnBehavior: NONE
|
||||
# 更详细的日志输出 会有性能损耗 org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
# 关闭日志记录 (可单纯使用 p6spy 分析) org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||
# 默认日志输出 org.apache.ibatis.logging.slf4j.Slf4jImpl
|
||||
logImpl: org.apache.ibatis.logging.slf4j.Slf4jImpl
|
||||
cacheEnabled: true
|
||||
|
||||
|
||||
# MyBatis-Flex全局配置
|
||||
global-config:
|
||||
# 是否控制台打印 MyBatis-Flex 的 LOGO 及版本号
|
||||
print-banner: false
|
||||
# 逻辑删除数据存在标记值
|
||||
normal-value-of-logic-delete: 0
|
||||
# 逻辑删除数据存在标记值
|
||||
deleted-value-of-logic-delete: 1
|
||||
|
||||
|
||||
datasource:
|
||||
# 数据源-1
|
||||
PrimaryDS:
|
||||
# 指定为HikariDataSource
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
ds1:
|
||||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
||||
type: ${spring.datasource.type}
|
||||
# mysql数据库
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3306/ruoyi-flex?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: Root@369
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# url: jdbc:mysql://localhost:3306/ruoyi-flex?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
|
||||
# username: root
|
||||
# password: Root@369
|
||||
#postgresql数据库
|
||||
# driver-class-name: org.postgresql.Driver
|
||||
# url: jdbc:postgresql://localhost:5432/ruoyi-flex?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
|
||||
# username: postgres
|
||||
# password: postgres@369
|
||||
driver-class-name: org.postgresql.Driver
|
||||
url: jdbc:postgresql://localhost:5432/ruoyi-flex?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
|
||||
username: postgres
|
||||
password: postgres@369
|
||||
|
||||
hikari:
|
||||
#连接池名
|
||||
pool-name: HikariCP-PrimaryDS
|
||||
#最小空闲连接数
|
||||
minimum-idle: 10
|
||||
# 空闲连接存活最大时间,默认10分钟
|
||||
idle-timeout: 600000
|
||||
# 连接池最大连接数,默认是10
|
||||
maximum-pool-size: 20
|
||||
# 此属性控制从池返回的连接的默认自动提交行为,默认值:true
|
||||
auto-commit: true
|
||||
# 此属性控制池中连接的最长生命周期,值0表示无限生命周期,默认30分钟
|
||||
max-lifetime: 1800000
|
||||
# 数据库连接超时时间,默认30秒
|
||||
connection-timeout: 30000
|
||||
# 校验超时时间
|
||||
validationTimeout: 5000
|
||||
# 多久检查一次连接的活性
|
||||
keepaliveTime: 30000
|
||||
# 连接测试query
|
||||
connection-test-query: SELECT 1
|
||||
# # 数据源-2
|
||||
# ds2:
|
||||
# # 指定为HikariDataSource
|
||||
# type: ${spring.datasource.type}
|
||||
# # mysql数据库
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# url: jdbc:mysql://localhost:3306/ruoyi-flex?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true
|
||||
# username: root
|
||||
# password: Root@369
|
||||
# #postgresql数据库
|
||||
## driver-class-name: org.postgresql.Driver
|
||||
## url: jdbc:postgresql://localhost:5432/ruoyi-flex?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
|
||||
## username: postgres
|
||||
## password: postgres@369
|
||||
|
||||
# redis 单机配置(单机与集群只能开启一个另一个需要注释掉)
|
||||
spring.data:
|
||||
@ -114,19 +90,7 @@ redisson:
|
||||
# 发布和订阅连接池大小
|
||||
subscriptionConnectionPoolSize: 50
|
||||
|
||||
--- # Actuator 监控端点的配置项
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: '*'
|
||||
endpoint:
|
||||
health:
|
||||
show-details: ALWAYS
|
||||
logfile:
|
||||
external-file: ./logs/ruoyi-monitor.log
|
||||
|
||||
--- # 监控中心配置
|
||||
--- # 监控中心客户端配置
|
||||
spring.boot.admin.client:
|
||||
# 增加客户端开关
|
||||
enabled: true
|
||||
@ -143,12 +107,11 @@ powerjob:
|
||||
enabled: true
|
||||
# 需要先在 powerjob 登录页执行应用注册后才能使用
|
||||
app-name: ruoyi-worker
|
||||
enable-test-mode: false
|
||||
max-appended-wf-context-length: 4096
|
||||
max-result-length: 4096
|
||||
# 28080 端口 随着主应用端口飘逸 避免集群冲突
|
||||
port: 2${server.port}
|
||||
protocol: http
|
||||
server-address: 127.0.0.1:7700
|
||||
store-strategy: disk
|
||||
|
||||
enable-test-mode: false
|
||||
max-appended-wf-context-length: 4096
|
||||
max-result-length: 4096
|
||||
|
@ -3,7 +3,7 @@ ruoyi:
|
||||
# 名称
|
||||
name: Ruoyi-Flex
|
||||
# 版本
|
||||
version: 4.2.0
|
||||
version: ${revision}
|
||||
# 版权年份
|
||||
copyrightYear: 2023
|
||||
# 实例演示开关
|
||||
@ -101,21 +101,55 @@ spring:
|
||||
# 热部署开关
|
||||
enabled: true
|
||||
|
||||
# token配置
|
||||
token:
|
||||
# 令牌自定义标识
|
||||
header: Authorization
|
||||
# 令牌密钥
|
||||
secret: abcdefghijklmnopqrstuvwxyz
|
||||
# 令牌有效期(默认30分钟)
|
||||
expireTime: 30
|
||||
|
||||
# PageHelper分页插件
|
||||
pagehelper:
|
||||
helperDialect: mysql
|
||||
#helperDialect: mysql、postgresql pagehelper分页插件会自动检测当前的数据库链接,自动选择合适的分页方式。
|
||||
supportMethodsArguments: true
|
||||
params: count=countSql
|
||||
|
||||
# MyBatisFlex公共配置
|
||||
# https://mybatis-flex.com/zh/base/configuration.html
|
||||
mybatis-flex:
|
||||
# 搜索指定包别名
|
||||
type-aliases-package: com.ruoyi.**.domain
|
||||
# 不支持多包, 如有需要可在注解配置 或 提升扫包等级:com.**.**.mapper
|
||||
mapper-package: com.ruoyi.**.mapper
|
||||
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
mapper-locations: classpath*:mapper/**/*Mapper.xml
|
||||
configuration:
|
||||
## 以下为mybatis原生配置 https://mybatis.org/mybatis-3/zh/configuration.html
|
||||
# 自动驼峰命名规则(camel case)映射
|
||||
map_underscore_to_camel_case: true
|
||||
# MyBatis 自动映射策略
|
||||
# NONE:不启用 PARTIAL:只对非嵌套 resultMap 自动映射 FULL:对所有 resultMap 自动映射
|
||||
auto_mapping_behavior: FULL
|
||||
# MyBatis 自动映射时未知列或未知属性处理策
|
||||
# NONE:不做处理 WARNING:打印相关警告 FAILING:抛出异常和详细信息
|
||||
auto_mapping_unknown_column_behavior: NONE
|
||||
# 更详细的日志输出 会有性能损耗 org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
# 关闭日志记录 org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||
# 默认日志输出 org.apache.ibatis.logging.slf4j.Slf4jImpl
|
||||
#log_impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
logImpl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
cacheEnabled: true
|
||||
global-config:
|
||||
# 是否控制台打印 MyBatis-Flex 的 LOGO 及版本号
|
||||
print-banner: true
|
||||
# 全局的 ID 生成策略配置:雪花算法
|
||||
key-config:
|
||||
key-type: Generator
|
||||
value: snowFlakeId
|
||||
# 逻辑未删除值
|
||||
normal-value-of-logic-delete: 0
|
||||
# 逻辑已删除值(框架表均使用此值 禁止随意修改)
|
||||
deleted-value-of-logic-delete: 1
|
||||
# 默认的逻辑删除字段
|
||||
logic-delete-column: del_flag
|
||||
# 默认的多租户字段
|
||||
#tenant-column: tenant_id
|
||||
# 默认的乐观锁字段
|
||||
version-column: version
|
||||
|
||||
# SpringDoc配置
|
||||
springdoc:
|
||||
#需要扫描的包,可以配置多个,使用逗号分割
|
||||
@ -188,6 +222,15 @@ lock4j:
|
||||
# 分布式锁的超时时间,默认为 30 秒
|
||||
expire: 30000
|
||||
|
||||
## token配置
|
||||
#token:
|
||||
# # 令牌自定义标识
|
||||
# header: Authorization
|
||||
# # 令牌密钥
|
||||
# secret: abcdefghijklmnopqrstuvwxyz
|
||||
# # 令牌有效期(默认30分钟)
|
||||
# expireTime: 30
|
||||
|
||||
# Sa-Token配置
|
||||
sa-token:
|
||||
# token名称 (同时也是cookie名称)
|
||||
|
@ -27,7 +27,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
* @author dataprince数据小王子
|
||||
*/
|
||||
@Configuration
|
||||
@MapperScan("${mybatis-flex.mapperPackage}")
|
||||
@MapperScan("${mybatis-flex.mapper-package}")
|
||||
public class MyBatisFlexConfig implements ConfigurationCustomizer, MyBatisFlexCustomizer {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger("mybatis-flex-sql");
|
||||
@ -54,30 +54,15 @@ public class MyBatisFlexConfig implements ConfigurationCustomizer, MyBatisFlexCu
|
||||
*/
|
||||
@Override
|
||||
public void customize(FlexGlobalConfig globalConfig) {
|
||||
//统一设置数据库表主键为雪花算法
|
||||
FlexGlobalConfig.KeyConfig keyConfig = new FlexGlobalConfig.KeyConfig();
|
||||
keyConfig.setKeyType(KeyType.Generator);
|
||||
keyConfig.setValue(KeyGenerators.snowFlakeId);
|
||||
keyConfig.setBefore(true);
|
||||
globalConfig.setKeyConfig(keyConfig);
|
||||
|
||||
// 注册全局数据填充监听器
|
||||
globalConfig.registerInsertListener(new EntityInsertListener(), BaseEntity.class);
|
||||
globalConfig.registerUpdateListener(new EntityUpdateListener(), BaseEntity.class);
|
||||
|
||||
//全局配置逻辑删除字段
|
||||
globalConfig.setLogicDeleteColumn("del_flag");
|
||||
|
||||
//全局配置乐观锁字段
|
||||
globalConfig.setVersionColumn("version");
|
||||
|
||||
// 开启审计功能
|
||||
AuditManager.setAuditEnable(true);
|
||||
// AuditManager.setMessageFactory(new AuditMessageFactory());
|
||||
// 设置 SQL 审计收集器
|
||||
AuditManager.setMessageCollector(new ConsoleMessageCollector());
|
||||
|
||||
|
||||
}
|
||||
|
||||
//TODO:动态表名
|
||||
|
Loading…
Reference in New Issue
Block a user