-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Allow map binding to work with unescaped characters #13404
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
Comments
The new binder is much stricter about property names which means you need to surround them in square brackets. Try the following: shiro:
testMap:
"[/test1]": test1
"[/test2]": test2 |
I'm wonder if there's any way we can make this more user friendly. I've flagged the issue for discussion at our next call. |
Thank you! According to your suggestion it can be used normally, I hope there are relevant examples in the official document... |
We might be able to get the original key in the |
This also tripped me up while migrating to 2.0 because I have URLs as keys, something like:
and it used to work fine with 1.5. After finding this issue, I changed this map to:
and now it parses correctly. Please document this explicitly in the migration guide or reference doc. |
…need to surround them in square brackets, see spring-projects/spring-boot#13404
Hi, it indeed works well with the use of brackets, but it is quite unnatural to do so. |
@Chatom We're aware that there's some room for improvement here. That's why this issue remains open. |
Any idea when this could be improved? Is there some better way around this (other than using brackets) ? |
@maraswrona The issue is in the 2.x milestone which means it'll be considered for inclusion in 2.3. |
I'd really prefer the binder to fail fast with an exception when it discovers unescaped property names. Currently 2.2.1 silently modifies the property name by removing special characters which is a nightmare to debug. |
Is there a way to scape the square brackets? I need my Map key to be |
@pablocavalieri I believe you can do this: testMap:
"[some value[value between square brackets]]": "test" |
Uh oh!
There was an error while loading. Please reload this page.
Spring boot version: 2.0.2 (1.5.13 is normal)
Problem Description:
If the map key is with “/”, it cannot be parsed normally. Others are normal.
Example:
Configuration class
Test class
console info:
The text was updated successfully, but these errors were encountered: