How do I use the @PreDestroy annotation in EJB 3.0?

Byron Tymvios

You will firstly need to import javax.annotation.PreDestroy before you can use the annotation. Then annotate a method with @PreDestroy

public void preDestroy(){
    //Place your pre destruction code here
A @PreDestroy annotated method will execute directly after the @Remove method has finished executing and before the bean instance is removed by the container. After this method has executed the bean can be garbage collected.