spring-boot: Environment variable that does not follow guidelines for use of _ is still successfully bound if another property source contains a property that is bound to the same target
We have custom properties, built like this:
@ConfigurationProperties("yona")
@Configuration
public class YonaProperties
{
@NestedConfigurationProperty
private final AnalysisServiceProperties analysisService = new AnalysisServiceProperties();
Properties would be set on AnalysisServiceProperties in this way:
yona.analysisService.someProperty=someValue
Or through an environment variable, like this:
YONA_ANALYSIS_SERVICE_SOME_PROPERTY=someValue
With Spring Boot 1.5, it was OK to not have any yona.analysisService.xxx property in application.properties and still set one through an environment variable like YONA_ANALYSIS_SERVICE_XXX.
With Spring Boot 2.0.4, that doesn’t work anymore. At least one yona.analysisService.xxx must exist in application.properties. It’s OK to set xxx in application.properties and yyy through the environment, but there needs to be at least one.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 18 (14 by maintainers)
We’d like to fix this by the binding ignoring the environment variable that’s malformed.