Class ControllerAdviceBean

java.lang.Object
org.springframework.web.method.ControllerAdviceBean
All Implemented Interfaces:
Ordered

public class ControllerAdviceBean extends Object implements 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 annotation.

Since:
3.2
Author:
Rossen Stoyanchev, Brian Clozel, Juergen Hoeller, Sam Brannen
  • Constructor Details

    • ControllerAdviceBean

      public ControllerAdviceBean(Object bean)
      Create a ControllerAdviceBean using the given bean instance.
      Parameters:
      bean - the bean instance
    • ControllerAdviceBean

      public ControllerAdviceBean(String beanName, BeanFactory beanFactory)
      Create a ControllerAdviceBean using the given bean name and BeanFactory.
      Parameters:
      beanName - the name of the bean
      beanFactory - a BeanFactory to retrieve the bean type initially and later to resolve the actual bean
    • ControllerAdviceBean

      public ControllerAdviceBean(String beanName, BeanFactory beanFactory, @Nullable ControllerAdvice controllerAdvice)
      Create a ControllerAdviceBean using the given bean name, BeanFactory, and @ControllerAdvice annotation.
      Parameters:
      beanName - the name of the bean
      beanFactory - a BeanFactory to retrieve the bean type initially and later to resolve the actual bean
      controllerAdvice - the @ControllerAdvice annotation for the bean, or null if not yet retrieved
      Since:
      5.2
  • Method Details