SpringBoot多配置文件,切换环境


多配置文件

properties配置方式

 application.properties

#通过active指定选用配置环境
spring.profiles.active=test

application-dev.properties

#开发环境
server.port=8081

application-test.properties

#测试环境
server.port=8082

application-pro.properties

#生产环境
server.port=8083

yml配置方式

 application.yml

#通过active指定选用配置环境
spring:
  profiles:
  active: pro

application-dev.yml

#开发环境
server:
  port: 8081

application-test.yml

#测试环境
server:
  port: 8082

application-pro.yml

#生产环境
server:
  port: 8083

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM