List of usage examples for org.springframework.core.annotation AnnotatedElementUtils findMergedAnnotation
@Nullable public static <A extends Annotation> A findMergedAnnotation(AnnotatedElement element, Class<A> annotationType)
From source file:org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder.java
private static String getMethodRequestMapping(Method method) { Assert.notNull(method, "'method' must not be null"); RequestMapping requestMapping = AnnotatedElementUtils.findMergedAnnotation(method, RequestMapping.class); if (requestMapping == null) { throw new IllegalArgumentException("No @RequestMapping on: " + method.toGenericString()); }//from w w w .j av a 2 s. co m String[] paths = requestMapping.path(); if (ObjectUtils.isEmpty(paths) || StringUtils.isEmpty(paths[0])) { return "/"; } if (paths.length > 1 && logger.isWarnEnabled()) { logger.warn("Multiple paths on method " + method.toGenericString() + ", using first one"); } return paths[0]; }