Annotation Type PreDestroy


  • @Documented
    @Retention(RUNTIME)
    @Target(METHOD)
    public @interface PreDestroy
    The PreDestroy annotation is used on a method as a callback notification to signal that the instance is in the process of being removed by the container.

    Note that we can equally use any PreDestroy annotation - so we can use the one from javax.annotation, jakarta.annotation or this one.

    The method annotated with PreDestroy is typically used to release resources that it has been holding.

    The method on which the PreDestroy annotation is applied must fulfill the following criteria:

    • The method must not have any parameters.
    • The method may be public, protected or package private.
    • The method must not be static.