@ControllerAdvice
Spring-managed bean without necessarily requiring it to be instantiated.
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 annotation.
| Modifier and Type | Field and Description |
|---|---|
| private final BeanFactory | |
| private final Object | beanOrName
Reference to the actual bean instance or a |
| private final Class | |
| private final HandlerTypePredicate | |
| private final boolean | |
| private Integer | |
| private Object | resolvedBean
Reference to the resolved bean instance, potentially lazily retrieved
via the |
| Access | Constructor and Description |
|---|---|
| public | ControllerAdviceBean(Object
the bean instance bean)Create a |
| public | ControllerAdviceBean(String
the name of the bean beanName, BeanFactory a beanFactory)BeanFactory to retrieve the bean type initially
and later to resolve the actual beanCreate a |
| public | ControllerAdviceBean(String
the name of the bean beanName, BeanFactory a beanFactory, ControllerAdvice BeanFactory to retrieve the bean type initially
and later to resolve the actual beanthe controllerAdvice)@ControllerAdvice annotation for the
bean, or null if not yet retrievedCreate a |
| Modifier and Type | Method and Description |
|---|---|
| private static HandlerTypePredicate | |
| private static HandlerTypePredicate | |
| public boolean | equals(Object
the reference object with which to compare. other)Overrides java. |
| public static List | findAnnotatedBeans(ApplicationContext context)
Find beans annotated with |
| public Class | |
| private static Class | |
| public int | getOrder()
Implements org. |
| public int | |
| public boolean | isApplicableToBeanType(Class<?>
the type of the bean to check beanType)Check whether the given bean type should be advised by this
|
| private BeanFactory | |
| public Object | resolveBean()
Get the bean instance for this |
| public String |
| beanFactory | back to summary |
|---|---|
| private final BeanFactory beanFactory
| |
| beanOrName | back to summary |
|---|---|
| private final Object beanOrName Reference to the actual bean instance or a | |
| beanType | back to summary |
|---|---|
| private final Class<?> beanType
| |
| beanTypePredicate | back to summary |
|---|---|
| private final HandlerTypePredicate beanTypePredicate | |
| isSingleton | back to summary |
|---|---|
| private final boolean isSingleton | |
| order | back to summary |
|---|---|
| private Integer order
| |
| resolvedBean | back to summary |
|---|---|
| private Object resolvedBean Reference to the resolved bean instance, potentially lazily retrieved
via the | |
| ControllerAdviceBean | back to summary |
|---|---|
| public ControllerAdviceBean(Object bean) Create a
| |
| ControllerAdviceBean | back to summary |
|---|---|
| public ControllerAdviceBean(String beanName, BeanFactory beanFactory) Create a
| |
| ControllerAdviceBean | back to summary |
|---|---|
| public ControllerAdviceBean(String beanName, BeanFactory beanFactory, ControllerAdvice controllerAdvice) Create a
| |
| createBeanTypePredicate | back to summary |
|---|---|
| private static HandlerTypePredicate createBeanTypePredicate(Class<?> beanType) | |
| createBeanTypePredicate | back to summary |
|---|---|
| private static HandlerTypePredicate createBeanTypePredicate(ControllerAdvice controllerAdvice) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| findAnnotatedBeans | back to summary |
|---|---|
| public static List Find beans annotated with As of Spring Framework 5.2, the
| |
| getBeanType | back to summary |
|---|---|
| public Class Return the type of the contained bean. If the bean type is a CGLIB-generated class, the original user-defined class is returned.
| |
| getBeanType | back to summary |
|---|---|
private static Class
| |
| getOrder | back to summary |
|---|---|
| public int getOrder() Implements org. Get the order value for the contained bean. As of Spring Framework 5.3, the order value is lazily retrieved using
the following algorithm and cached. Note, however, that a
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isApplicableToBeanType | back to summary |
|---|---|
| public boolean isApplicableToBeanType(Class<?> beanType) Check whether the given bean type should be advised by this
| |
| obtainBeanFactory | back to summary |
|---|---|
| private BeanFactory obtainBeanFactory() | |
| resolveBean | back to summary |
|---|---|
| public Object resolveBean() Get the bean instance for this As of Spring Framework 5.2, once the bean instance has been resolved it
will be cached if it is a singleton, thereby avoiding repeated lookups in
the | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |