9 Replies Latest reply on Dec 29, 2009 6:37 PM by Gavin King

    Disposing and InjectionPoint integration?

    John Ament Master

      So let's say I have an injection point defined something like


      @Inject @RequestScoped @MyQualifier(type=A,name="Charlie") SomeBean someBean;


      When processing the injection, it's easy to just call the init() method on SeamBean, because there's stuff I want to do.  However, when an instance of this goes away (at the end of the session), I need to call a cleanUp() method on SeamBean.  The trouble is that there are many injection points for this same bean within the same request lifecycle (at least, if I've read right, it's the same bean going into each injection point).  Is this a case where I want to use @NonBinding on the methods in @MyQualifier?  Then I can define a dispose method




      public void disposeOfSomeBean(@Inject @RequestScoped @MyQualifier SomeBean someBean) {
      someBean.cleanUp();
      }