@ -19,6 +19,7 @@ package org.springframework.web.method;
@@ -19,6 +19,7 @@ package org.springframework.web.method;
import java.lang.annotation.Annotation ;
import java.util.ArrayList ;
import java.util.Arrays ;
import java.util.Collections ;
import java.util.LinkedHashSet ;
import java.util.List ;
import java.util.Set ;
@ -102,13 +103,16 @@ public class ControllerAdviceBean implements Ordered {
@@ -102,13 +103,16 @@ public class ControllerAdviceBean implements Ordered {
}
ControllerAdvice annotation = AnnotationUtils . findAnnotation ( beanType , ControllerAdvice . class ) ;
if ( annotation = = null ) {
throw new IllegalArgumentException (
"Bean type [" + beanType . getName ( ) + "] is not annotated as @ControllerAdvice" ) ;
if ( annotation ! = null ) {
this . basePackages = initBasePackages ( annotation ) ;
this . assignableTypes = Arrays . asList ( annotation . assignableTypes ( ) ) ;
this . annotations = Arrays . asList ( annotation . annotations ( ) ) ;
}
else {
this . basePackages = Collections . emptySet ( ) ;
this . assignableTypes = Collections . emptyList ( ) ;
this . annotations = Collections . emptyList ( ) ;
}
this . basePackages = initBasePackages ( annotation ) ;
this . assignableTypes = Arrays . asList ( annotation . assignableTypes ( ) ) ;
this . annotations = Arrays . asList ( annotation . annotations ( ) ) ;
}