解决:spring.profiles.active=dev 多实例不生效问题
目录问题spring boot 2.x 运行指定配置(application-dev2.yml)文件,没有生效解决spring-boot 2.x 使用mvn spring-boot:run -Dspring-boot.run.profiles=XXX效果解决问题依据多实例配置过程pom.xml问题spring boot 2.x 运行指定配置(application-dev2.yml)文件,没...
·
目录
问题
spring boot 2.x 运行指定配置(application-dev2.yml)文件,没有生效
mvn spring-boot:run -Pdev2
解决
spring-boot 2.x 使用mvn spring-boot:run -Dspring-boot.run.profiles=XXX
mvn spring-boot:run -Dspring-boot.run.profiles=dev2或者线上发布
java -jar -Dspring.profiles.active=dev2 demo-0.0.1-SNAPSHOT.jar
效果
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.6.RELEASE)
2020-05-03 - [ main] d.s.d.DomeApplication : The following profiles are active: dev2
解决问题依据
https://docs.spring.io/spring-boot/docs/2.0.1.RELEASE/maven-plugin/examples/run-profiles.html
多实例配置过程

pom.xml
<profiles>
<profile>
<id>dev1</id>
<properties>
<spring.profiles.active>dev1</spring.profiles.active>
</properties>
</profile>
<profile>
<id>dev2</id>
<properties>
<spring.profiles.active>dev2</spring.profiles.active>
</properties>
</profile>
</profiles>
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)