You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In org.springframework.data.mapping.PropertyMatch, the matches(String name, Class<?> type) method currently uses String.matches(...):
if ((namePattern != null) && !name.matches(namePattern)) {
return false;
}
I noticed this while profiling application startup — PropertyMatch.matches(...) is invoked repeatedly during Spring Data repository and mapping initialization, which makes the repeated regex compilation visible in startup.
Proposed improvement
Pre-compile the namePattern in the constructor of PropertyMatch as a java.util.regex.Pattern.
Change matches(...) to use Pattern.matcher(...).matches().