-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Add possibility to escape property placeholders #30671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add possibility to escape property placeholders #30671
Conversation
Thanks for the PR. I've played with the code a bit and already polished quite a bit so I'll probably cherry-pick if you have time to update it. That doesn't work for default value having a property placeholder in it, something like:
if |
@snicoll yes, i will fix it |
One thing I had in mind would be to have a data structure that represents a bit of text and some extra information. You could then handle those cases:
Perhaps with a method that needs to "emit" the value and does the replacement by calling a function. I haven't really looked at the problem in details but it looks like we may remove the escape character "too soon" and we end up in another branch that is not aware that it should be escaped. Having a data structure may also simplify a bit of the code. Food for thoughts, and thanks for looking at it! |
This commit adds support for escaping a property placeholder using a configurable prefix. If a property placeholder is prefixed this way, it is not resolved. By default, '\' is used but the feature can be disabled by setting it to null. See spring-projectsgh-30671
This commit allows to escape property placeholders to later processed by user. PropertyPlaceholderHelper allows to set custom escape character. "\" is used as the default one. Closes spring-projectsgh-9628 Signed-off-by: Dmitrii Bocharov <[email protected]>
Tried for some time to solve it. The code really becomes ugly. The problem with the existing mr is indeed that the escape character is removed "too soon". While trying to fix it, I've come up with some more tests, which I'm not sure how they should work:
What should |
It's fine we can continue here as we're trying to figure out the best way to move forward with the code. Thanks for the follow-up and I am not surprised things get messy with corner cases. To answer your questions:
I don't know if the above helps or makes it even worse. Let me know :) |
Signed-off-by: Dmitrii Bocharov <[email protected]>
Signed-off-by: Dmitrii Bocharov <[email protected]>
8a13aee
to
97a324d
Compare
Finally, i've updated it :) |
@bdshadow I want to acknowledge that I've seen this. Getting the espacing to work is quite involved as we both feared. If nobody beats me to it, I'll need some quality time to review and provide more feedback if needed. That won't happen before we start 6.2 in anger in a month or so. |
Thank you @snicoll. Totally understand. Looking forward to it |
It turns out quite tricky and, while I don't have a definitive implementation for this, I did rewrite the parser from scratch as I felt this was the only way to address this issue and other issues reported against it. Thanks for the PR and your efforts. |
This commit allows to escape property placeholders to later processed by user. PropertyPlaceholderHelper allows to set custom escape character. "" is used as the default one.
Closes gh-9628