Skip to content

spring.config.activate.on-profile cannot be used in profile specific file #24990

@markusheiden

Description

@markusheiden

We use the "multi properties files in one" feature of Spring Boot 2.4.

With the change from Spring Boot 2.4.1 to 2.4.2 the following does no longer work:

application-xxx.properties

yyy=1
#---  
spring.config.activate.on-profile=zzz
yyy=2
org.springframework.boot.context.config.InvalidConfigDataPropertyException: Property 'spring.config.activate.on-profile' imported from location 'class path resource [application-xxx.properties]' is invalid in a profile specific resource [origin: class path resource [application-xxx.properties] - 28:35]
	at org.springframework.boot.context.config.InvalidConfigDataPropertyException.lambda$throwOrWarn$1(InvalidConfigDataPropertyException.java:121) ~[spring-boot-2.4.2.jar:2.4.2]
	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
	at java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1087) ~[?:?]
	at org.springframework.boot.context.config.InvalidConfigDataPropertyException.throwOrWarn(InvalidConfigDataPropertyException.java:118) ~[spring-boot-2.4.2.jar:2.4.2]
	at org.springframework.boot.context.config.ConfigDataEnvironment.checkForInvalidProperties(ConfigDataEnvironment.java:349) ~[spring-boot-2.4.2.jar:2.4.2]

If I incorrectly used this feature I apologize upfront.

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions