Consistent hasAnnotation check for findMergedAnnotation lookup
Issue: SPR-16933
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,7 +24,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.core.MethodIntrospector;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||
import org.springframework.messaging.handler.annotation.MessageExceptionHandler;
|
||||
import org.springframework.messaging.handler.invocation.AbstractExceptionHandlerMethodResolver;
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.springframework.messaging.handler.invocation.AbstractExceptionHandler
|
||||
* or from the method signature as a fallback option.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Juergen Hoeller
|
||||
* @since 4.0
|
||||
*/
|
||||
public class AnnotationExceptionHandlerMethodResolver extends AbstractExceptionHandlerMethodResolver {
|
||||
@@ -50,7 +51,7 @@ public class AnnotationExceptionHandlerMethodResolver extends AbstractExceptionH
|
||||
private static Map<Class<? extends Throwable>, Method> initExceptionMappings(Class<?> handlerType) {
|
||||
Map<Method, MessageExceptionHandler> methods = MethodIntrospector.selectMethods(handlerType,
|
||||
(MethodIntrospector.MetadataLookup<MessageExceptionHandler>) method ->
|
||||
AnnotationUtils.findAnnotation(method, MessageExceptionHandler.class));
|
||||
AnnotatedElementUtils.findMergedAnnotation(method, MessageExceptionHandler.class));
|
||||
|
||||
Map<Class<? extends Throwable>, Method> result = new HashMap<>();
|
||||
for (Map.Entry<Method, MessageExceptionHandler> entry : methods.entrySet()) {
|
||||
|
||||
Reference in New Issue
Block a user