001package io.avaje.inject; 002 003import java.lang.annotation.Documented; 004import java.lang.annotation.Retention; 005import java.lang.annotation.Target; 006 007import static java.lang.annotation.ElementType.METHOD; 008import static java.lang.annotation.RetentionPolicy.RUNTIME; 009 010/** 011 * The <code>PreDestroy</code> annotation is used on a method as a callback notification 012 * to signal that the instance is in the process of being removed by the container. 013 * <p> 014 * Note that we can equally use any <code>PreDestroy</code> annotation - so we can use 015 * the one from <code>javax.annotation</code>, <code>jakarta.annotation</code> or this one. 016 * <p> 017 * The method annotated with <code>PreDestroy</code> is typically used to release resources 018 * that it has been holding. 019 * <p> 020 * The method on which the <code>PreDestroy</code> annotation is applied must fulfill the 021 * following criteria: 022 * <ul> 023 * <li>The method must not have any parameters.</li> 024 * <li>The method may be public, protected or package private.</li> 025 * <li>The method must not be static.</li> 026 * </ul> 027 */ 028@Documented 029@Retention(RUNTIME) 030@Target(METHOD) 031public @interface PreDestroy { 032 033 /** 034 * Specify the priority of the destroy method to control its execution 035 * order relative to other destroy methods. 036 * <p> 037 * Low values execute earlier than high values. All destroy methods without 038 * any explicit priority are given a value of 1000. 039 */ 040 int priority() default 1000; 041}