两种配置方式 1:在一个yml文件中,2:在多个yml文件中
1 一个yml文件
application.yml
spring:
profiles:
active: dev
---
#开发环境配置
spring:
profiles: dev
server:
port: 1000
---
#测试环境配置
spring:
profiles: stg
server:
port: 1001
---
#生产环境配置
spring:
profiles: prd
server:
port: 1002
2 多个yml文件
application.yml
spring:
profiles:
active: dev
application-dev.yml
server:
port: 1000
application-stg.yml
server:
port: 1001
application-prd.yml
server:
port: 1002
废话不多说,简单明了。