You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue relates highly to Spring Cloud Config but was introduced directly by changes made in #24733 (released in Spring Boot 2.4.2) so I report it here. I'll move it to SCC if needed.
In my current setup I share some common configuration between applications using profiles.
Configuration repository contains application.yml file with properties shared among all apps. There are also additional application-xxx.yml files containing properties shared by a subset of services e.g. application-rabbitmq.yml
App-specific, but not profile-specific files (e.g. calculator.yml) declares spring.profiles.include=rabbitmq property with all profiles that should be used to retrieve given app's config. All apps are started without marking any profiles as active/included.
This approach seems to be supported by Spring Cloud Config Server as well as when I request some app's config using the default profile (<config-server-uri>/calculator/default) in response I receive "main" files: application.yml, calculator.yml, as well as files specific to the declared profile: application-rabbitmq.yml. When I change spring.profiles.include in application.yml to other value, application-rabbitmq.yml is not included anymore. This means SCCS recognizes this property and takes it into account when determining which properties files should be returned.
Now to the main problem - the setup described above works well with Spring Boot 2.4.1 but has stopped after the upgrade to 2.4.2.
Now the client app crashes at startup with:
16:43:55.562 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
org.springframework.boot.context.config.InvalidConfigDataPropertyException: Property 'spring.profiles.include' imported from location '[ConfigServerConfigDataResource@e84a8e1 uris = array<String>['http://localhost:8888'], optional = false, profiles = list['default']]' is invalid in a profile specific resource [origin: Config Server (snip)/calculator.yml:3:14]
InvalidConfigDataPropertyException throws an exception during processing of ConfigDataEnvironmentContributor instance responsible for handling cloud config server as a source. The contributor is marked as "profileSpecific" and therefore it's forbidden for it to contain "profiles properties".
When I move spring.profiles.include from calculator.yml to application.yml the app crashes as well.
I don't know what exactly causes the contributor to be marked as "profileSpecific". Spring Cloud Config Client makes a request to the Spring Cloud Config Server using "default" as profile name when the app was started without any profile, The response from the server looks like this:
I created a simple repository with config server that presents the problem. It's even more simplified then the description above as configuration served by SCCS doesn't include an application-specific files, just appplication.yml and application-demo.yml: https://github.com/konradczajka/cloud-config-profile-issue-demo
In my opinion it should be permitted to specify profiles in an external configuration as long as particular file is not profile-specific but I'm aware that there may be a good reason for forbidding that. I'd just like to know if that's a case and I'll just look for other solution to my sharing problem. And if It's not advised to include any profiles-related properties in any file served by SCCS then maybe its documentation should mention it.
Regards.
The text was updated successfully, but these errors were encountered:
This issue relates highly to Spring Cloud Config but was introduced directly by changes made in #24733 (released in Spring Boot 2.4.2) so I report it here. I'll move it to SCC if needed.
In my current setup I share some common configuration between applications using profiles.
Configuration repository contains
application.yml
file with properties shared among all apps. There are also additionalapplication-xxx.yml
files containing properties shared by a subset of services e.g.application-rabbitmq.yml
App-specific, but not profile-specific files (e.g.
calculator.yml
) declaresspring.profiles.include=rabbitmq
property with all profiles that should be used to retrieve given app's config. All apps are started without marking any profiles as active/included.This approach seems to be supported by Spring Cloud Config Server as well as when I request some app's config using the default profile (
<config-server-uri>/calculator/default
) in response I receive "main" files:application.yml
,calculator.yml
, as well as files specific to the declared profile:application-rabbitmq.yml
. When I changespring.profiles.include
inapplication.yml
to other value,application-rabbitmq.yml
is not included anymore. This means SCCS recognizes this property and takes it into account when determining which properties files should be returned.Now to the main problem - the setup described above works well with Spring Boot 2.4.1 but has stopped after the upgrade to 2.4.2.
Now the client app crashes at startup with:
InvalidConfigDataPropertyException
throws an exception during processing ofConfigDataEnvironmentContributor
instance responsible for handling cloud config server as a source. The contributor is marked as "profileSpecific" and therefore it's forbidden for it to contain "profiles properties".When I move
spring.profiles.include
fromcalculator.yml
toapplication.yml
the app crashes as well.I don't know what exactly causes the contributor to be marked as "profileSpecific". Spring Cloud Config Client makes a request to the Spring Cloud Config Server using "default" as profile name when the app was started without any profile, The response from the server looks like this:
I created a simple repository with config server that presents the problem. It's even more simplified then the description above as configuration served by SCCS doesn't include an application-specific files, just
appplication.yml
andapplication-demo.yml
:https://github.com/konradczajka/cloud-config-profile-issue-demo
In my opinion it should be permitted to specify profiles in an external configuration as long as particular file is not profile-specific but I'm aware that there may be a good reason for forbidding that. I'd just like to know if that's a case and I'll just look for other solution to my sharing problem. And if It's not advised to include any profiles-related properties in any file served by SCCS then maybe its documentation should mention it.
Regards.
The text was updated successfully, but these errors were encountered: