Switch to AnnotatedElementUtils.findXxx for @MVC

Issue: SPR-12296
This commit is contained in:
Rossen Stoyanchev
2015-04-24 11:23:00 -04:00
parent 8376e1eca1
commit 86fd0afbf2
2 changed files with 4 additions and 4 deletions

View File

@@ -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());
}

View File

@@ -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;