diff --git a/spring-web/src/main/java/org/springframework/web/bind/annotation/ControllerAdvice.java b/spring-web/src/main/java/org/springframework/web/bind/annotation/ControllerAdvice.java index 3e24c1dcb5d..f8240a9fa8c 100644 --- a/spring-web/src/main/java/org/springframework/web/bind/annotation/ControllerAdvice.java +++ b/spring-web/src/main/java/org/springframework/web/bind/annotation/ControllerAdvice.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. @@ -46,16 +46,16 @@ import org.springframework.stereotype.Component; *

Note: For {@code @ExceptionHandler} methods, a root exception match will be * preferred to just matching a cause of the current exception, among the handler * methods of a particular advice bean. However, a cause match on a higher-priority - * advice will still be preferred to a any match (whether root or cause level) + * advice will still be preferred over any match (whether root or cause level) * on a lower-priority advice bean. As a consequence, please declare your primary - * root exception mappings on a prioritized advice bean with a corresponding order! + * root exception mappings on a prioritized advice bean with a corresponding order. * - *

By default the methods in an {@code @ControllerAdvice} apply globally to - * all Controllers. Use selectors {@link #annotations()}, - * {@link #basePackageClasses()}, and {@link #basePackages()} (or its alias - * {@link #value()}) to define a more narrow subset of targeted Controllers. - * If multiple selectors are declared, OR logic is applied, meaning selected - * Controllers should match at least one selector. Note that selector checks + *

By default, the methods in an {@code @ControllerAdvice} apply globally to + * all controllers. Use selectors {@link #annotations}, + * {@link #basePackageClasses}, and {@link #basePackages} (or its alias + * {@link #value}) to define a more narrow subset of targeted controllers. + * If multiple selectors are declared, boolean {@code OR} logic is applied, meaning + * selected controllers should match at least one selector. Note that selector checks * are performed at runtime and so adding many selectors may negatively impact * performance and add complexity. * @@ -98,8 +98,8 @@ public @interface ControllerAdvice { String[] basePackages() default {}; /** - * Type-safe alternative to {@link #value()} for specifying the packages - * to select Controllers to be assisted by the {@code @ControllerAdvice} + * Type-safe alternative to {@link #basePackages} for specifying the packages + * in which to select controllers to be advised by the {@code @ControllerAdvice} * annotated class. *

Consider creating a special no-op marker class or interface in each package * that serves no purpose other than being referenced by this attribute. @@ -110,16 +110,16 @@ public @interface ControllerAdvice { /** * Array of classes. *

Controllers that are assignable to at least one of the given types - * will be assisted by the {@code @ControllerAdvice} annotated class. + * will be advised by the {@code @ControllerAdvice} annotated class. * @since 4.0 */ Class[] assignableTypes() default {}; /** * Array of annotations. - *

Controllers that are annotated with this/one of those annotation(s) - * will be assisted by the {@code @ControllerAdvice} annotated class. - *

Consider creating a special annotation or use a predefined one, + *

Controllers that are annotated with at least one of the supplied annotations + * will be advised by the {@code @ControllerAdvice} annotated class. + *

Consider creating a custom composed annotation or use a predefined one, * like {@link RestController @RestController}. * @since 4.0 */ diff --git a/spring-web/src/main/java/org/springframework/web/method/ControllerAdviceBean.java b/spring-web/src/main/java/org/springframework/web/method/ControllerAdviceBean.java index 8ba2cf1d108..528d9dfd54b 100644 --- a/spring-web/src/main/java/org/springframework/web/method/ControllerAdviceBean.java +++ b/spring-web/src/main/java/org/springframework/web/method/ControllerAdviceBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. @@ -32,12 +32,12 @@ import org.springframework.util.ClassUtils; import org.springframework.web.bind.annotation.ControllerAdvice; /** - * Encapsulates information about an {@linkplain ControllerAdvice @ControllerAdvice} + * Encapsulates information about an {@link ControllerAdvice @ControllerAdvice} * Spring-managed bean without necessarily requiring it to be instantiated. * *

The {@link #findAnnotatedBeans(ApplicationContext)} method can be used to * discover such beans. However, a {@code ControllerAdviceBean} may be created - * from any object, including ones without an {@code @ControllerAdvice}. + * from any object, including ones without an {@code @ControllerAdvice} annotation. * * @author Rossen Stoyanchev * @author Brian Clozel @@ -113,7 +113,7 @@ public class ControllerAdviceBean implements Ordered { /** - * Returns the order value extracted from the {@link ControllerAdvice} + * Return the order value extracted from the {@link ControllerAdvice} * annotation, or {@link Ordered#LOWEST_PRECEDENCE} otherwise. */ @Override @@ -146,11 +146,11 @@ public class ControllerAdviceBean implements Ordered { } /** - * Check whether the given bean type should be assisted by this - * {@code @ControllerAdvice} instance. + * Check whether the given bean type should be advised by this + * {@code ControllerAdviceBean}. * @param beanType the type of the bean to check * @since 4.0 - * @see org.springframework.web.bind.annotation.ControllerAdvice + * @see ControllerAdvice */ public boolean isApplicableToBeanType(@Nullable Class beanType) { return this.beanTypePredicate.test(beanType); @@ -181,9 +181,9 @@ public class ControllerAdviceBean implements Ordered { /** - * Find the names of beans annotated with - * {@linkplain ControllerAdvice @ControllerAdvice} in the given - * ApplicationContext and wrap them as {@code ControllerAdviceBean} instances. + * Find beans annotated with {@link ControllerAdvice @ControllerAdvice} in the + * given {@link ApplicationContext} and wrap them as {@code ControllerAdviceBean} + * instances. */ public static List findAnnotatedBeans(ApplicationContext context) { return Arrays.stream(BeanFactoryUtils.beanNamesForTypeIncludingAncestors(context, Object.class)) diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java index c183da6f50e..024ee53792a 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. @@ -99,7 +99,7 @@ import org.springframework.web.util.WebUtils; /** * Extension of {@link AbstractHandlerMethodAdapter} that supports - * {@link RequestMapping} annotated {@code HandlerMethod RequestMapping} annotated {@code HandlerMethods}. + * {@link RequestMapping @RequestMapping} annotated {@link HandlerMethod HandlerMethods}. * *

Support for custom argument and return value types can be added via * {@link #setCustomArgumentResolvers} and {@link #setCustomReturnValueHandlers},