Files
schoolNews/schoolNewsServ/system/src/main/resources/application.yml
2025-09-28 17:32:37 +08:00

99 lines
2.4 KiB
YAML

server:
port: 8082
spring:
application:
name: school-news-system
# 数据源配置
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/school_news?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
username: root
password: root
# Druid 配置
druid:
initial-size: 5
min-idle: 5
max-active: 20
max-wait: 60000
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000
validation-query: SELECT 1
test-while-idle: true
test-on-borrow: false
test-on-return: false
pool-prepared-statements: true
max-pool-prepared-statement-per-connection-size: 20
# 监控统计配置
filter:
stat:
enabled: true
db-type: mysql
log-slow-sql: true
slow-sql-millis: 2000
wall:
enabled: true
db-type: mysql
# Web监控配置
web-stat-filter:
enabled: true
url-pattern: /*
exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"
stat-view-servlet:
enabled: true
url-pattern: /druid/*
reset-enable: false
login-username: admin
login-password: admin123
# MyBatis Plus配置
mybatis-plus:
# 实体类扫描包
type-aliases-package: org.xyzh.common.dto
# mapper xml文件位置
mapper-locations: classpath:mapper/*.xml
# 全局配置
global-config:
db-config:
# 主键策略:雪花算法
id-type: assign_id
# 逻辑删除字段
logic-delete-field: deleted
logic-delete-value: 1
logic-not-delete-value: 0
# 字段填充策略
insert-strategy: not_null
update-strategy: not_null
select-strategy: not_empty
# SQL配置
configuration:
# 开启驼峰命名转换
map-underscore-to-camel-case: true
# 开启二级缓存
cache-enabled: true
# 打印SQL
log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
# 日志配置
logging:
config: classpath:log4j2-spring.xml
level:
org.xyzh.system: DEBUG
org.xyzh.system.mapper: DEBUG
# 管理端点配置
management:
endpoints:
web:
exposure:
include: health,info,metrics
endpoint:
health:
show-details: when-authorized