spring-projects / spring-projects/spring-framework

Introduce support for escaping the escape character for property placeholders

Open
#34,315 15 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

in: core type: enhancement
Dominant language
Java
Stars
60.2k
Forks
38.8k
Avg merge
5d 2h
Merged PRs (30d)
27

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with org.springframework.util.PlaceholderParser and its SimplePlaceholderPart.resolveRecursively(PartResolutionContext, String) and parse(String, boolean) methods. Reproduce the property-placeholder examples from the issue and trace both parsing passes. Done means an escaped escape character preserves the expected backslash while placeholders still resolve correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.