spring多环境切换

多文件

环境

# application.yml 文件中:
# application-dev.yml 中的配置会覆盖 application.yml 的配置(有相同配置时)
spring: 
  profiles:
    active: dev
# 也可以在运行时指定:
java -jar xxx.jar --spring.profiles.active=dev

单文件

spring:
  profiles:
    active: dev
# ...


---
spring:
  profiles: dev
# ...


---
spring:
  profiles: prd
# ...


---
spring:
  profiles: stg
# ...
posted @ 2020-11-04 12:42  qianbuhan  阅读(86)  评论(0)    收藏  举报