多配置文件
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
Original: https://www.cnblogs.com/xiaozhang666/p/13822430.html
Author: 一半人生
Title: SpringBoot多配置文件,切换环境
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/541101/
转载文章受原作者版权保护。转载请注明原作者出处!