Class LifecycleBeanPostProcessor

  • All Implemented Interfaces:
    org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor, org.springframework.core.Ordered, org.springframework.core.PriorityOrdered

    public class LifecycleBeanPostProcessor
    extends Object
    implements org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor, org.springframework.core.PriorityOrdered
    Bean post processor that calls Constructable.init() and Destroyable.destroy() for every bean that implements these interfaces. In contrast to the PostConstruct and PreDestroy annotations, these methods will also be called if they are declared in a super class of the bean. This postprocess will be called at the same stages, CommonAnnotationBeanPostProcessor would be called: Constructor Bean-Injections Settings-Injections init() ... destroy()
    Since:
    1.0.0
    See Also:
    Constructable, Destroyable
    • Constructor Detail

      • LifecycleBeanPostProcessor

        public LifecycleBeanPostProcessor()
    • Method Detail

      • getOrder

        public int getOrder()
        Specified by:
        getOrder in interface org.springframework.core.Ordered
      • setOrder

        public void setOrder​(int order)
      • postProcessAfterInitialization

        public Object postProcessAfterInitialization​(Object bean,
                                                     String beanName)
        Specified by:
        postProcessAfterInitialization in interface org.springframework.beans.factory.config.BeanPostProcessor
      • postProcessBeforeDestruction

        public void postProcessBeforeDestruction​(Object bean,
                                                 String beanName)
        Specified by:
        postProcessBeforeDestruction in interface org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor
      • postProcessBeforeInitialization

        public Object postProcessBeforeInitialization​(Object bean,
                                                      String beanName)
        Specified by:
        postProcessBeforeInitialization in interface org.springframework.beans.factory.config.BeanPostProcessor
      • requiresDestruction

        public boolean requiresDestruction​(Object bean)
        Specified by:
        requiresDestruction in interface org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor