第一步
<profiles>
<profile>
<id>dev</id>
<properties>
<spring.profiles.active>dev</spring.profiles.active>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>pro</id>
<properties>
<spring.profiles.active>pro</spring.profiles.active>
</properties>
</profile>
</profiles>
第二步
配置 spring.profiles.active
spring:
profiles:
active: @spring.profiles.active@