多配置文件配置(properties):
格式:
applicatino-{profile}.properties
默认:
applicatino.properties
开发:
applicatino-dev.properties
生产:
applicatino-prod.properties
激活配置:
spring.profiles.active=dev
多文档块配置(yml)
server: port: 9090spring: profiles: active; dev ---server: port: 9091spring: profiles: dev ---server: port: 9092spring: profiles: prod
激活环境:
Idea激活指定环境配置:
Idea->Run/Debug Configuration->Program arguments:
--spring.profiles.active=dev
Idea虚拟机参数:
Idea->Run/Debug Configuration->VM options
--Dspring.profiles.active=dev
命令行激活指定环境配置:
java -jar xxx.jar --spring.profiles.active=dev