4 Replies Latest reply on Apr 26, 2012 8:16 AM by lucasvc

    Interception in not injected method bean




      Following the docs from Weld about interceptors, somethings work great. But my case is not working.

      As the example, I want a method marked as @Transactional. So I create the annotation, the @Interceptor bean (with @AroundInvoke method annotated) and declare the bean in beans.xml. The method to be intercepted with @Transactional is something like:





      public User getUser() {

           if (user == null) {

                user = retrieveFromDatabase();


           return user;



      This works great. But I realize, that although I don't need to retrieve from database, the interceptor method is called anyway (as it should be).

      But if I decide to delete the @Transactional from the method, and annotate the method retrieveFromDatabase(), the interceptor is not called.

      The only difference between both methods is the "injection". The first method is injected, but the second one not (is called directly).

      I used the interception patter in other beans that are injected and it works great too.

      I'm working with Weld 1.1.3.Final, in a Tomcat 6.0.35.


      • Is this a requirement? (the method / bean has to be "injected", and not called directly)
      • Is a bug from Weld?
      • A bug from docs? Because there is no reference about that the bean should be an injected.
      • Maybe a bug only for Tomcat?

      For the moment, I can't test this case in JBoss or with newer Weld version.