0 Replies Latest reply on Jul 24, 2012 2:36 AM by tarioch

    Constructor injection on EJB interceptors not working?

    tarioch

      Hi,

       

      Using JBoss 7.1 I use an EJB intercepter and would like to use constructor inject. This does not seem to work, but normal injection works fine.

       

      This one fails with

       

      Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011056: No default constructor for interceptor class

       

      public class CacheInterceptor {

       

          private final DummyCache myCache;

       

          @Inject

          public CacheInterceptor(final DummyCache myCache) {

              this.myCache = myCache;

          }

       

          @AroundInvoke

          public Object intercept(final InvocationContext ctx) throws Exception {

      ....

          }

      }

       

       

      but this works fine and DummyCache gets injected

       

      public class CacheInterceptor {

       

          @Inject

          private DummyCache myCache;

       

         

          public CacheInterceptor() {

          }

       

          @AroundInvoke

          public Object intercept(final InvocationContext ctx) throws Exception {

      ....

          }

      }