SpringBoot Version: 2.4.2
This is the error message
org.springframework.boot.context.config.InvalidConfigDataPropertyException: Property 'spring.config.activate.on-profile' imported from location 'class path resource [application-dev.yml]' is invalid in a profile specific resource [origin: class path resource [application-dev.yml] - 5:19] at org.springframework.boot.context.config.InvalidConfigDataPropertyException.lambda$throwOrWarn$1(InvalidConfigDataPropertyException.java:121)
application-dev.yml
spring:
config:
activate:
on-profile: dev
application.yml
spring:
profiles:
active: dev
How should I solve this problem? Can someone help me?
Comment From: ye21st
Problem solved:
SpringBoot Version: 2.3.1.RELEASE -> 2.4.2
Suppose there are the following configuration files under the resource
folder:
application.yml
application-dev.yml
application-prod.yml
application-common.yml
Solution:
application.yml
## 2.3.1.RELEASE
spring:
profiles:
active: dev
include: common
## 2.4.2
spring:
profiles:
active: dev
group:
dev: common
test: common
prod: common
application-dev.yml
## 2.3.1.RELEASE
spring:
profiles: dev
## 2.4.2
spring:
## The current environment does not need to be specified, the program will automatically find the
## corresponding environment configuration according to the configuration file name
application-prod.yml
## 2.3.1.RELEASE
spring:
profiles: prod
## 2.4.2
spring:
## The current environment does not need to be specified, the program will automatically find the
## corresponding environment configuration according to the configuration file name