JavaEE Tip #4 - PreDestroy

With the @PreDestroy annotation you annotate a single method in your class that you want to be called just before your object (EJB, JSF managed bean, CDI bean) is taken out of service.

In code


    @PreDestroy
    public void destroy() {
        // put your destroy code here.
    } 
        

Posted December 13, 2014

Up