stdproject/backend/src/main/resources/application.yml
weitang c0a64d9ac8 feat: 设置日志级别
设置数据库查询日志的数据级别
2025-07-09 14:32:48 +08:00

190 lines
6.0 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

server:
port: 8083
servlet:
context-path: /
encoding:
charset: UTF-8
enabled: true
force: true
compression:
enabled: true
mime-types: text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json
min-response-size: 1024
spring:
profiles:
active: ${SPRING_PROFILES_ACTIVE:dev}
application:
name: stdproject-backend
main:
allow-bean-definition-overriding: true
datasource:
url: ${DB_URL:jdbc:mysql://192.168.1.58:3306/gis_test?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true}
username: ${DB_USERNAME:root}
password: ${DB_PASSWORD:123456}
driver-class-name: com.mysql.cj.jdbc.Driver
# HikariCP连接池配置
hikari:
pool-name: StdProjectHikariCP
minimum-idle: 5
maximum-pool-size: 20
auto-commit: true
idle-timeout: 30000
max-lifetime: 1800000
connection-timeout: 30000
connection-test-query: SELECT 1
flyway:
enabled: true
table: flyway_schema_history
validate-on-migrate: true
locations: classpath:db/migration
baseline-on-migrate: true
out-of-order: true
cache:
jcache:
config: classpath:ehcache.xml # 指定Ehcache配置文件路径
security:
cors:
allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:3000,http://localhost:8080}
max-age: ${CORS_MAX_AGE:3600} # 预检请求的缓存时间(秒)
jwt:
enabled: ${JWT_ENABLED:false} # 控制是否启用JWT认证
secret: ${JWT_SECRET:YourJWTSecretKeyForStdProjectBackendApplicationWhichIsVeryLongAndSecure2024!@#$%^&*()}
expiration-ms: ${JWT_EXPIRATION:86400000} # Token 过期时间 (例如: 24小时)
refresh-expiration-ms: ${JWT_REFRESH_EXPIRATION:604800000} # 刷新Token过期时间 (例如: 7天)
rsa:
private-key: ${RSA_PRIVATE_KEY:MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A==}
mybatis-plus:
mapper-locations: classpath*:/mybatis/**/*.xml # MyBatis Mapper XML文件位置
type-aliases-package: com.stdproject.entity
global-config:
db-config:
id-type: ASSIGN_ID # ID生成策略assign_id 表示手动分配ID通常使用雪花算法等
table-prefix: ${DB_TABLE_PREFIX:} # 如果表名有统一前缀,可以在这里配置
logic-delete-field: deleted # 逻辑删除字段名
logic-delete-value: 1 # 逻辑删除值
logic-not-delete-value: 0 # 逻辑未删除值
banner: false # 关闭MyBatis-Plus启动横幅
configuration:
map-underscore-to-camel-case: true # 开启驼峰命名转换
cache-enabled: true # 开启二级缓存
lazy-loading-enabled: true # 开启延迟加载
multiple-result-sets-enabled: true # 开启多结果集
use-column-label: true # 使用列标签
use-generated-keys: true # 使用生成的主键
auto-mapping-behavior: partial # 自动映射行为
default-executor-type: simple # 默认执行器类型
default-statement-timeout: 25000 # 默认语句超时时间
log-impl: ${MYBATIS_LOG_IMPL:org.apache.ibatis.logging.nologging.NoLoggingImpl} # SQL日志实现
logging:
config: classpath:logback-spring.xml # Logback配置文件
level:
root: ${LOG_LEVEL_ROOT:INFO}
com.stdproject: ${LOG_LEVEL_APP:DEBUG}
org.springframework.security: ${LOG_LEVEL_SECURITY:WARN}
org.hibernate.SQL: ${LOG_LEVEL_SQL:WARN}
org.hibernate.type.descriptor.sql.BasicBinder: ${LOG_LEVEL_SQL_PARAMS:WARN}
org.flywaydb: DEBUG
com.stdproject.service.manage: INFO
pattern:
console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
file: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
springdoc:
api-docs:
path: /v3/api-docs
enabled: ${SWAGGER_ENABLED:true}
swagger-ui:
path: /swagger-ui.html
enabled: ${SWAGGER_UI_ENABLED:true}
operations-sorter: alpha
tags-sorter: alpha
try-it-out-enabled: true
filter: true
default-consumes-media-type: application/json
default-produces-media-type: application/json
show-actuator: ${SWAGGER_SHOW_ACTUATOR:true}
packages-to-scan: com.stdproject.controller
# 管理端点配置
management:
endpoints:
web:
exposure:
include: ${ACTUATOR_ENDPOINTS:health,info,metrics}
base-path: /actuator
endpoint:
health:
show-details: ${ACTUATOR_HEALTH_DETAILS:when-authorized}
info:
enabled: true
info:
env:
enabled: true
java:
enabled: true
os:
enabled: true
# 应用信息配置
info:
app:
name: ${spring.application.name}
description: StdProject Backend Application
version: 1.0.0
encoding: UTF-8
java:
version: ${java.version}
---
# 开发环境配置
spring:
config:
activate:
on-profile: dev
security:
jwt:
enabled: false
logging:
level:
com.stdproject: DEBUG
org.hibernate.SQL: DEBUG
org.hibernate.type.descriptor.sql.BasicBinder: TRACE
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl #org.apache.ibatis.logging.stdout.StdOutImpl #org.apache.ibatis.logging.nologging.NoLoggingImpl
springdoc:
swagger-ui:
enabled: true
---
# 生产环境配置
spring:
config:
activate:
on-profile: prod
security:
jwt:
enabled: true
logging:
level:
root: WARN
com.stdproject: INFO
org.springframework.security: ERROR
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
springdoc:
api-docs:
enabled: false
swagger-ui:
enabled: false
management:
endpoints:
web:
exposure:
include: health,info