前言
SpringBoot配置多环境文件的时候需要配置多个yml文件,2.4版本之前的配置如下:
spring:
profiles:
active: dev
但是如果SpringBoot的版本在2.4之后这样配置会报错
: Property ‘[0]’ imported from location ‘class path resource []’ is invalid in a profile specific resource [origin: class path resource [] - 9:7]
解决方法
将配置改成如下即可:
spring:
config:
activate:
on-profile:
- dev
当然,将SpringBoot版本回退至2.4以前也可解决
???? 欢迎前往博客主页查看更多内容
???? 如果觉得不错,期待您的点赞、收藏、评论、关注
???? 如有错误欢迎指正!