springboot配置文件
springboot
支持yml
或者properties
两种方式
- 无论是哪种方式,都可以指定
active
的profiles
的
profiles官方文档
spring
支持在application.properties
中直接配置数据库连接。
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/test?useSSL=false&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
spring.datasource.username=test
spring.datasource.password=test12345
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
- 当我们开发功能的时候,区分本地测试,测试服务器,正式上线的服务器,分别为
dev
,qa</