2 Replies Latest reply on Oct 5, 2008 1:49 PM by Ivan Rododendro

    Method-level interceptors & callback methods

    Ivan Rododendro Newbie

      Hello,
      we're running under JBAS 5CR2 and it seems that callback methods on Interceptors are not called if the interceptor is declared method-level on the EJB.

      public class MyInterceptor {
      
       @PostConstruct
       public void init(InvocationContext c) {
       // do some stuff
       }
      
      }
      
      @Stateless
      public class MyBean implements MyRemote {
      
       @Interceptors(MyInterceptor.class)
       public void myMethod {
       // do some business stuff
       }
      }
      


      So init() method of interceptor class is never called.

      If I declare the same interceptor as a class-level, init() method is correctly called.

      From what I can understand from EJB3 Spec and jboss docs, externals interceptor should have always the same lifecycle (which is tied to bean's lifecycle) no matter if they are declared class-level or method-level.

      Am I wrong? Is there already a bug on JIRA ?

      Thanks
      Ivan