Skip to content

Commit 86fd0af

Browse files
committed
Switch to AnnotatedElementUtils.findXxx for @MVC
Issue: SPR-12296
1 parent 8376e1e commit 86fd0af

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ private static UriComponentsBuilder getBaseUrlToUse(UriComponentsBuilder baseUrl
379379
private static String getTypeRequestMapping(Class<?> controllerType) {
380380
Assert.notNull(controllerType, "'controllerType' must not be null");
381381
String annotType = RequestMapping.class.getName();
382-
AnnotationAttributes attrs = AnnotatedElementUtils.getAnnotationAttributes(controllerType, annotType);
382+
AnnotationAttributes attrs = AnnotatedElementUtils.findAnnotationAttributes(controllerType, annotType);
383383
if (attrs == null) {
384384
return "/";
385385
}
@@ -396,7 +396,7 @@ private static String getTypeRequestMapping(Class<?> controllerType) {
396396

397397
private static String getMethodRequestMapping(Method method) {
398398
String annotType = RequestMapping.class.getName();
399-
AnnotationAttributes attrs = AnnotatedElementUtils.getAnnotationAttributes(method, annotType);
399+
AnnotationAttributes attrs = AnnotatedElementUtils.findAnnotationAttributes(method, annotType);
400400
if (attrs == null) {
401401
throw new IllegalArgumentException("No @RequestMapping on: " + method.toGenericString());
402402
}

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerMapping.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,13 @@ private RequestMappingInfo createRequestMappingInfo(AnnotatedElement annotatedEl
246246
if (annotatedElement instanceof Class<?>) {
247247
Class<?> type = (Class<?>) annotatedElement;
248248
annotation = AnnotationUtils.findAnnotation(type, RequestMapping.class);
249-
attributes = AnnotatedElementUtils.getAnnotationAttributes(type, annotationType);
249+
attributes = AnnotatedElementUtils.findAnnotationAttributes(type, annotationType);
250250
customCondition = getCustomTypeCondition(type);
251251
}
252252
else {
253253
Method method = (Method) annotatedElement;
254254
annotation = AnnotationUtils.findAnnotation(method, RequestMapping.class);
255-
attributes = AnnotatedElementUtils.getAnnotationAttributes(method, annotationType);
255+
attributes = AnnotatedElementUtils.findAnnotationAttributes(method, annotationType);
256256
customCondition = getCustomMethodCondition(method);
257257
}
258258
RequestMappingInfo info = null;

0 commit comments

Comments
 (0)