application.yml
# 通用配置
spring:
profiles:
active: test
server:
servlet:
context-path: /aaa
---
# dev环境
spring:
config:
activate:
on-profile: dev
server:
port: 8081
---
# test环境
spring:
config:
activate:
on-profile: test
server:
port: 8082
servlet:
context-path: /bbb # 特定环境的优先级高于通用配置
---
# prod环境
spring:
config:
activate:
on-profile: prod
server:
port: 8083