Spring Boot 的多环境配置
语法结构:application-{profile}.properties/yml
profile:代表某个配置环境的标识
示例:
application-dev.properties/yml 开发环境
application-test.properties/yml 测试环境
application-prod.properties/yml 生产环境
1 Windows 环境下启动方式
java -jar xxx.jar --spring.profiles.active={profile}
dev-开发环境
test-测试环境
2 Idea中启动方式
dev-开发环境
test-测试环境