柯基笔记:优化启动配置,properties改为yml
- 作者:柯基大佬
- 日期:2021-10-20
- 类型:Java
- 说明:本文源于 柯基 手写摘要,如需转载请带上链接或注明出处!
优化启动配置,properties改为yml
yml缩进严格
把之前的配置转换为yml的文件重写一下
一、application.yml
spring: profiles: active: dev
|
一、application-dev.yml
server: port: 1234
servlet: encoding: force: true
spring: thymeleaf: check-template-location: false enabled: false
datasource: name: test url: jdbc:mysql://localhost:3306/a2j?characterEncoding=utf-8 username: root password: 12345678 driver-class-name: com.mysql.cj.jdbc.Driver
hikari: max-lifetime: 500000
mybatis: mapper-locations: classpath:mapper/*.xml type-aliases-package: com.a2j configuration: map-underscore-to-camel-case: true cache-enabled: false
logging: level: com.a2j.mapper.*: debug config: classpath:log/logback-dev.xml
|
一、application-prod.yml
server: port: 12345
servlet: encoding: force: true
spring: thymeleaf: check-template-location: false enabled: false
datasource: name: test url: jdbc:mysql://localhost:3306/a2j?characterEncoding=utf-8 username: root password: 12345678 driver-class-name: com.mysql.cj.jdbc.Driver
hikari: max-lifetime: 500000
mybatis: mapper-locations: classpath:mapper/*.xml type-aliases-package: com.a2j configuration: map-underscore-to-camel-case: true cache-enabled: false
logging: level: com.a2j.mapper.*: debug config: classpath:log/logback-dev.xml
|