Interface DisposableBeanDefinition<T>

Type Parameters:
T - The bean definition type
All Superinterfaces:
AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, ArgumentCoercible<T>, BeanContextConditional, BeanDefinition<T>, BeanInfo<T>, BeanType<T>, Named, Ordered, QualifiedBeanType<T>
All Known Subinterfaces:
DisposableIntercepted<T>
All Known Implementing Classes:
ReflectionBeanDefinition

@Internal public interface DisposableBeanDefinition<T> extends BeanDefinition<T>
A bean definition that provides disposing hooks normally in the form of PreDestroy annotated methods.
Since:
1.0
Author:
Graeme Rocher
See Also:
  • Method Details

    • dispose

      default T dispose(BeanContext context, T bean)
      Disposes of the bean definition by executing all PreDestroy hooks.
      Parameters:
      context - The bean context
      bean - The bean
      Returns:
      The bean instance
    • dispose

      T dispose(BeanResolutionContext resolutionContext, BeanContext context, T bean)
      Disposes of the bean definition by executing all PreDestroy hooks.
      Parameters:
      resolutionContext - The bean resolution context
      context - The bean context
      bean - The bean
      Returns:
      The bean instance
    • getPreDestroyExecutableMethods

      default List<ExecutableMethod<T,?>> getPreDestroyExecutableMethods()
      The PreDestroy callbacks of the bean as reflection-free executable methods, in the order dispose(BeanResolutionContext, BeanContext, Object) invokes them.

      Only available for a bean that intercepts its pre-destroy phase, that is one bound with @InterceptorBinding(kind = PRE_DESTROY); every other definition, including one compiled by an earlier version, returns an empty list. The callbacks are not part of BeanDefinition.getExecutableMethods().

      Returns:
      The pre-destroy callbacks, or an empty list
      Since:
      5.2.0