Switch to AnnotatedElementUtils.findXxx for @MVC
Issue: SPR-12296
This commit is contained in:
@@ -379,7 +379,7 @@ public class MvcUriComponentsBuilder {
|
||||
private static String getTypeRequestMapping(Class<?> controllerType) {
|
||||
Assert.notNull(controllerType, "'controllerType' must not be null");
|
||||
String annotType = RequestMapping.class.getName();
|
||||
AnnotationAttributes attrs = AnnotatedElementUtils.getAnnotationAttributes(controllerType, annotType);
|
||||
AnnotationAttributes attrs = AnnotatedElementUtils.findAnnotationAttributes(controllerType, annotType);
|
||||
if (attrs == null) {
|
||||
return "/";
|
||||
}
|
||||
@@ -396,7 +396,7 @@ public class MvcUriComponentsBuilder {
|
||||
|
||||
private static String getMethodRequestMapping(Method method) {
|
||||
String annotType = RequestMapping.class.getName();
|
||||
AnnotationAttributes attrs = AnnotatedElementUtils.getAnnotationAttributes(method, annotType);
|
||||
AnnotationAttributes attrs = AnnotatedElementUtils.findAnnotationAttributes(method, annotType);
|
||||
if (attrs == null) {
|
||||
throw new IllegalArgumentException("No @RequestMapping on: " + method.toGenericString());
|
||||
}
|
||||
|
||||
@@ -246,13 +246,13 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi
|
||||
if (annotatedElement instanceof Class<?>) {
|
||||
Class<?> type = (Class<?>) annotatedElement;
|
||||
annotation = AnnotationUtils.findAnnotation(type, RequestMapping.class);
|
||||
attributes = AnnotatedElementUtils.getAnnotationAttributes(type, annotationType);
|
||||
attributes = AnnotatedElementUtils.findAnnotationAttributes(type, annotationType);
|
||||
customCondition = getCustomTypeCondition(type);
|
||||
}
|
||||
else {
|
||||
Method method = (Method) annotatedElement;
|
||||
annotation = AnnotationUtils.findAnnotation(method, RequestMapping.class);
|
||||
attributes = AnnotatedElementUtils.getAnnotationAttributes(method, annotationType);
|
||||
attributes = AnnotatedElementUtils.findAnnotationAttributes(method, annotationType);
|
||||
customCondition = getCustomMethodCondition(method);
|
||||
}
|
||||
RequestMappingInfo info = null;
|
||||
|
||||
Reference in New Issue
Block a user