Align validation metadata handling in PayloadMethodArgumentResolver

Reuses ValidationAnnotationUtils which is slightly optimized for the detection of Spring's Validated annotation now, also to the benefit of common web scenarios.

Closes gh-21852
This commit is contained in:
Juergen Hoeller
2023-08-16 12:48:06 +02:00
parent 1e75041b00
commit c7269feeaa
4 changed files with 37 additions and 32 deletions

View File

@@ -1309,8 +1309,8 @@ public abstract class AnnotationUtils {
*/
public static boolean isSynthesizedAnnotation(@Nullable Annotation annotation) {
try {
return ((annotation != null) && Proxy.isProxyClass(annotation.getClass()) &&
(Proxy.getInvocationHandler(annotation) instanceof SynthesizedMergedAnnotationInvocationHandler));
return (annotation != null && Proxy.isProxyClass(annotation.getClass()) &&
Proxy.getInvocationHandler(annotation) instanceof SynthesizedMergedAnnotationInvocationHandler);
}
catch (SecurityException ex) {
// Security settings disallow reflective access to the InvocationHandler: