spring-framework / org.springframework.web.method / ControllerAdviceBean

ControllerAdviceBean

open class ControllerAdviceBean : Ordered

Encapsulates information about an 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.

Author
Rossen Stoyanchev

Author
Brian Clozel

Author
Juergen Hoeller

Since
3.2

Constructors

<init>

ControllerAdviceBean(bean: Any)

Create a ControllerAdviceBean using the given bean instance.

ControllerAdviceBean(beanName: String, beanFactory: BeanFactory)

Create a ControllerAdviceBean using the given bean name.

Functions

equals

open fun equals(other: Any?): Boolean

findAnnotatedBeans

open static fun findAnnotatedBeans(applicationContext: ApplicationContext): MutableList<ControllerAdviceBean>

Find the names of beans annotated with ControllerAdvice in the given ApplicationContext and wrap them as ControllerAdviceBean instances.

getBeanType

open fun getBeanType(): Class<*>

Return the type of the contained bean.

If the bean type is a CGLIB-generated class, the original user-defined class is returned.

getOrder

open fun getOrder(): Int

Returns the order value extracted from the ControllerAdvice annotation, or Ordered#LOWEST_PRECEDENCE otherwise.

hashCode

open fun hashCode(): Int

isApplicableToBeanType

open fun isApplicableToBeanType(beanType: Class<*>): Boolean

Check whether the given bean type should be assisted by this @ControllerAdvice instance.

resolveBean

open fun resolveBean(): Any

Return a bean instance if necessary resolving the bean name through the BeanFactory.

toString

open fun toString(): String