报错: Property ‘spring.profiles’ imported from location ‘class path resource [application.yaml]’ is invalid and should be replaced with ‘spring.config.activate.on-profile’
解决方案:已经给出方案了:spring.profiles should be replaced with ‘spring.config.activate.on-profile’
意思就是把
spring:
profiles:
替换成:
spring:
config:
activate:
on-profile: dev
更改后完整代码如下:
#设置当前启用的环境
spring:
profiles:
active: dev
---
#开发环境
server:
port: 80
spring:
config:
activate:
on-profile: dev
---
#测试环境
spring:
config:
activate:
on-profile: test
server:
port: 81
---
#生产环境
spring:
config:
activate:
on-profile: produce
server:
port: 82