Skip to content

Fix regression in @PropertySource placeholder resolution [SPR-9133] #13772

@spring-projects-issues

Description

@spring-projects-issues

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:

Issue Links:

Referenced from: commits e30d610, 4df2a14

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions