Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property 'spring.config.activate.on-profile' is invalid in a profile specific resource #24941

Closed
s4got10dev opened this issue Jan 20, 2021 · 2 comments
Labels
status: invalid An issue that we don't feel is valid

Comments

@s4got10dev
Copy link

I have service that was using Spring Boot 2.4.1
For local development I have local profile and activate it using

application.yml:

spring:
  profiles:
    active: local

application-local.yml:

spring:
  config:
    activate:
      on-profile: local

After upgrading to Spring Boot 2.4.2 my application doesn't start with error

org.springframework.boot.context.config.InvalidConfigDataPropertyException: Property 'spring.config.activate.on-profile' imported from location 'class path resource [application-local.yml]' is invalid in a profile specific resource [origin: class path resource [application-local.yml] - 4:19]
	at org.springframework.boot.context.config.InvalidConfigDataPropertyException.lambda$throwOrWarn$1(InvalidConfigDataPropertyException.java:121)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1087)
	at org.springframework.boot.context.config.InvalidConfigDataPropertyException.throwOrWarn(InvalidConfigDataPropertyException.java:118)
	at org.springframework.boot.context.config.ConfigDataEnvironment.checkForInvalidProperties(ConfigDataEnvironment.java:349)
	at org.springframework.boot.context.config.ConfigDataEnvironment.applyToEnvironment(ConfigDataEnvironment.java:318)
	at org.springframework.boot.context.config.ConfigDataEnvironment.processAndApply(ConfigDataEnvironment.java:231)
	at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:97)

Should it somehow be changed or is this is a 🐛 ?

Thanks in advance

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 20, 2021
@wilkinsona
Copy link
Member

The exception being thrown is due to #24733. Prior to that change the property was silently ignored when it was used in a profile-specific file.

You don't need to set spring.config.activate.on-profile to local in application-local.yml as the whole file is already activated when the local profile is active.

@wilkinsona wilkinsona added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 20, 2021
@wilkinsona
Copy link
Member

While spring.profile.activate.on-profile wasn't necessary in this case, it could be used in a profile-specific file in Spring Boot 2.4.1. I was incorrect when I said above that the property was silently ignored. #24990 is now tracking this change in behaviour. It includes an example that can't be addressed by removing the use of the property as could be done here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants