Skip to content

Introduce support for escaping the escape character for property placeholders #34315

Open
@bitb4ker

Description

@bitb4ker

Up until spring-boot 3.3.8, an escaped backslash followed by a placeholder like:

prop1=value1  
prop2=value2\\${prop1}  

Resulted in prop2 resolving to:

value2\value1

Starting with spring-boot 3.4.0, the result is:

value2value1

Doubling the backslashes like this:

prop1=value1  
prop2=value2\\\\${prop1}  

Results in:

value2${prop1}

This is due to the escaping logic introduced in org.springframework.util.PlaceholderParser which does two passes of PlaceholderParser.SimplePlaceholderPart.resolveRecursively(PartResolutionContext, String), each calling PlaceholderParser.parse(String, boolean) in which the escaping logic is implemented.

This last method does not handle escaping the escape character, causing the issue.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions