spring-cloud / spring-cloud-commons

Common classes used in different Spring Cloud implementations
Apache License 2.0
704 stars 700 forks source link

Spring Cloud 2022.0.4 Config client failed when profile specific file contains include property #1300

Closed Ferioney closed 9 months ago

Ferioney commented 9 months ago

To continue to discus about a question in Config client failed when profile specific file contains include property.

After an update to the Spring Cloud 2022.0.4, with the same configuration as described in the first comment of issue Config client failed when profile specific file contains include property, I found that the application started without issues. Looks like Spring Cloud Client Config can handle the spring.profiles.include property as previously.

And now I see the next situation for minor versions:

Spring Cloud 2022.0.2. spring.profiles.include property allowed Spring Cloud 2022.0.3. spring.profiles.include property not allowed (validation error) Spring Cloud 2022.0.4. spring.profiles.include property allowed (again :)) In three versions we have a different behaviour. It's very difficult to plan and upgrade applications to the next version of Spring Cloud.

@ryanjbaxter Could you please describe how Spring Cloud Config Client should handle this property? And what plans for the future. Are you going to change current behaviour?

ryanjbaxter commented 9 months ago

I cannot reproduce this with 2022.0.4. I still see an error when using git and including a property source with spring.profiles.include

rg.springframework.cloud.config.server.environment.FailedToConstructEnvironmentException: Could not construct context for config=application profile=foo label= includeOrigin=true; nested exception is org.springframework.boot.context.config.InvalidConfigDataPropertyException: Property 'spring.profiles.include' imported from location 'file [/var/folders/k3/zv8hzdm17vv69j485fv3cf9r0000gp/T/config-repo-6052726661466752838/application-foo.yaml]' is invalid in a profile specific resource [origin: URL [file:/var/folders/k3/zv8hzdm17vv69j485fv3cf9r0000gp/T/config-repo-6052726661466752838/application-foo.yaml] - 2:26]
Ferioney commented 9 months ago

I prepared a small demo: demo_config Please look at README.md to reproduce

ryanjbaxter commented 9 months ago

When using a real config server the config server will fail to serve configuration if the profile specific configuration file contains spring.profiles.include

Ferioney commented 9 months ago

oh, forgot to say. We use Spring Cloud Config Server version 2.2.8.RELEASE. Unfortunately, we can not migrate to the latest version. A lot of out Java and non-Java services use Configuration server (and spring.profiles.include functionality). do you have some compatibility matrix for configuration server/client?

And one more question about bootstrap-application-context approach. For my services this approach works in Spring Cloud 2021 and 2022 (client config loading disabled, bootstrap enabled). Is bootstrap approach still on support? Do you have any plans to deprecate or remove it?

ryanjbaxter commented 9 months ago

do you have some compatibility matrix for configuration server/client?

In general we will try and maintain compatibility between minor releases for a given major, but we will not guarantee compatibility between major releases

Is bootstrap approach still on support? Do you have any plans to deprecate or remove it?

Yes it is still supported and we have no plans to remove it at the moment.

Ferioney commented 9 months ago

@ryanjbaxter thank you!