方式一:分开多个配置文件
# /src/main/resources/application.yaml
server:
port: 8080
spring:
profiles:
active: dev
# /src/main/resources/application-dev.yaml
server:
port: 8081
# /src/main/resources/application-test.yaml
server:
port: 8082
方式二:写在同一个配置文件中
# /src/main/resources/application.yaml
server:
port: 8080
spring:
profiles:
active: dev
---
server:
port: 8081
spring:
profiles: dev
---
server:
port: 8082
spring:
profiles: test