spring-projects / spring-projects/spring-framework
Introduce support for escaping the escape character for property placeholders
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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