-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Use StringUtils.replace(…) instead of String.replaceAll(…) for mapKeyDotReplacement #3613
Comments
Good catch. Care to submit a pull request that makes use of |
I'm behind a firewall so I can't submit a PR :-( |
Thanks for letting us know, we'll take care of this. |
…DotReplacement. We now use StringUtils.replace(…) to replace the map key dot in MappingMongoConverter. StringUtils perform a plain search instead of using Regex which improves the overall performance. Closes #3613
@mp911de, note that this is a breaking change that, AFAICS, is not mentioned in any upgrade guide. We were using It is only mentioned as a "new feature" in the release notes for this patch release: In my opinion it shouldn't even have been included in a patch release since patch releases should not require any work to upgrade. |
When configured to use
mapKeyDotReplacement
,MappingMongoConverter
will useString.replaceAll
to replace all dots in keys into specified replacement, which might cause unnecessary creation ofjava.util.regex.Pattern
repeatly. This will lead to rapid GC serialize/deserialize a huge (>= 10MB) mongo document multiple times.Codes in current version:
Suggestion:
Use
org.springframework.util.StringUtils#replace
ororg.apache.commons.lang3.StringUtils#replace(java.lang.String, java.lang.String, java.lang.String)
to replace dots instead.The text was updated successfully, but these errors were encountered: