-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Description
Mikhail Moussikhine opened SPR-9133 and commented
@Configuration
@PropertySource
({ "${property1}", "${property2}" })
class AppConfig {
}
Only first ${property1} placeholder will be resolved. Second and any other values will be used as is. The cause and fix are simple:
File:
./org.springframework.context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java
Function:
protected AnnotationMetadata doProcessConfigurationClass(ConfigurationClass configClass, AnnotationMetadata metadata) {}
Line: 187
for (int i = 0; i < nLocations; i++) {
locations[0] = this.environment.resolveRequiredPlaceholders(locations[0]);
}
Should be:
for (int i = 0; i < nLocations; i++) {
locations[i] = this.environment.resolveRequiredPlaceholders(locations[i]);
}
Just a typo, I guess.
Affects: 3.1.1
Sub-tasks:
- Backport "Fix regression in @PropertySource placeholder resolution" [SPR-9136] #13775 Backport "Fix regression in
@PropertySource
placeholder resolution"
Issue Links:
- Multiple PropertySource fails to use System property [SPR-9131] #13770 Multiple PropertySource fails to use System property ("is duplicated by")
- Resolving ${} system properties in @PropertySource annotation does not work anymore [SPR-9380] #14016 Resolving ${} system properties in
@PropertySource
annotation does not work anymore ("is duplicated by") - @PropertySource annotation with multiple values and a name fails to register all property sources [SPR-9127] #13766
@PropertySource
annotation with multiple values and a name fails to register all property sources