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
spring.profiles.included not permitted in externalized non-profile-specific properties #1788
Comments
I've briefly looked into this one and I think the problem is that The means that Spring Boot treats each contributor and |
We're going to need a change in both Spring Boot and Spring Cloud. For Spring Boot we're going to add a |
It's also going to be worth setting |
This will need to wait for boot 2.4.3 and hence 2020.0.2 |
It looks like Spring 2.4.3 was released, is this simply fixed by using that version or is there work that needs to be completed in this repo? https://spring.io/blog/2021/02/18/spring-boot-2-4-3-is-now-available |
I tried upgrading our gateway again using 2.4.3 and we seem to still hit the same issue. @philwebb I'm curious if the issue is fixed for you with 2.4.3? |
It's only fixed with boot 2.4.3 and Spring Cloud 2020.0.2-SNAPSHOT (release coming next week) |
@spencergibb Ohhh. My mistake. It didn't click when I read it originally, but now I see the commit you cited was for Spring Cloud. Thank you! |
@philwebb @spencergibb Thank you for the fix. I can use Please don't treat the rest of the message as a bug report of any kind and more like an "FYI". You can ignore it if you like. I came across some inconsistencies between how active and include profiles are processed depending on where they were defined (client app vs config repository) and I don't know if they are intentional or not:
Below you'll find results of some tests I performed:
|
Issue transferred from the Spring Boot issue tracker. See spring-projects/spring-boot#24876 originally raised by @konradczajka
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: