9 Replies Latest reply on Jun 6, 2013 10:54 AM by John Ament

    Interceptor bindings on manually installed beans

    John Ament Master

      (This is for CDI 1.0/ Weld 1.1.10)

       

      Hey, so I've run into an interesting issue (interesting in that our deployment structure is a little convoluted).

       

      What we've essentially done is created some JBoss Modules that deploy as libraries, that our main app then loads via jboss-deployment-structure.xml and some CDI extensions.  IN the CDI extensions, we have lines like this:

       

      void beforeBeans(@Observes final BeforeBeanDiscovery bbd, final BeanManager bm) {

          bbd.addAnnotatedType(bm.createAnnotatedType(FooManager.class));

      }

       

      On this FooManager, we have an interceptor binding, like this one:

       

      @PrincipalHasRoles("foo_admin")

      public FooResult updateFoo(final Foo foo) {

                ...

      }

       

      Which I would expect to get invoked using the interceptor, because the interceptor is listed in my beans.xml.  The interceptor does work when I annotated on my REST API (because the REST API lives in the war file, not in the library JARs).

       

      So am I wrong in believing that this should work? Do I need to handle any other start up events in Weld to make the interceptor work in this library?