public class ControllerAdviceBean extends Object implements Ordered
The findAnnotatedBeans(ApplicationContext) method can be used to
discover such beans. However, a ControllerAdviceBean may be created
from any object, including ones without an @ControllerAdvice.
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE| Constructor and Description |
|---|
ControllerAdviceBean(Object bean)
Create a
ControllerAdviceBean using the given bean instance. |
ControllerAdviceBean(String beanName,
BeanFactory beanFactory)
Create a
ControllerAdviceBean using the given bean name. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object other) |
static List<ControllerAdviceBean> |
findAnnotatedBeans(ApplicationContext applicationContext)
Find the names of beans annotated with
@ControllerAdvice in the given
ApplicationContext and wrap them as
ControllerAdviceBean instances. |
Class<?> |
getBeanType()
Return the type of the contained bean.
|
int |
getOrder()
Returns the order value extracted from the
ControllerAdvice
annotation, or Ordered.LOWEST_PRECEDENCE otherwise. |
int |
hashCode() |
Object |
resolveBean()
Return a bean instance if necessary resolving the bean name through the BeanFactory.
|
String |
toString() |
public ControllerAdviceBean(Object bean)
ControllerAdviceBean using the given bean instance.bean - the bean instancepublic ControllerAdviceBean(String beanName, BeanFactory beanFactory)
ControllerAdviceBean using the given bean name.beanName - the name of the beanbeanFactory - a BeanFactory that can be used later to resolve the beanpublic int getOrder()
ControllerAdvice
annotation, or Ordered.LOWEST_PRECEDENCE otherwise.public Class<?> getBeanType()
If the bean type is a CGLIB-generated class, the original user-defined class is returned.
public Object resolveBean()
public static List<ControllerAdviceBean> findAnnotatedBeans(ApplicationContext applicationContext)
ControllerAdviceBean instances.