0 Replies Latest reply on Nov 29, 2007 4:51 PM by Bram Biesbrouck

    @PreDestroy and injected JavaBeans

    Bram Biesbrouck Newbie

      Hi all,

      I'm trying to do the following:

      public class OutboxManagerImpl extends AbstractManagerImpl implements OutboxManager, Serializable
       private Map<Principal, List<EmailMessage>> queuedMessages;
       private EmailMessenger emailMessenger;
       [constructors, getters, setters, ...]
       public void cleanup()
       try {
       } catch (EmailException e) {
       public void destroy()

      Everything works fine, but when the @PreDestroy method is called, the injected JavaBean (POJO with @Name("emailMessenger")) has become null. I tried to re-inject it manually, but some other initialization-things (eg. the email renderer) go wrong then.

      Am I missing the point here that the injected values are already irrevocably destroyed when @PreDestroy is reached/called, or is this expected behavior? If so, how do I send my queued mails when the session goes out of scope?

      thanks a lot,