0
点赞
收藏
分享

微信扫一扫

Spring Boot 的多环境配置

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}

Spring Boot 的多环境配置_测试环境

dev-开发环境

Spring Boot 的多环境配置_开发环境_02

test-测试环境

Spring Boot 的多环境配置_开发环境_03

2 Idea中启动方式

dev-开发环境

Spring Boot 的多环境配置_jar_04

Spring Boot 的多环境配置_开发环境_05

test-测试环境

Spring Boot 的多环境配置_测试环境_06

Spring Boot 的多环境配置_测试环境_07


举报

相关推荐

0 条评论