5 Replies Latest reply on Nov 16, 2007 7:52 AM by pmuir

    How to use Seam interceptor?

    xinhua

      Hello everybody,

      i want to create an annotation @JndiInject("java:/....") above an attribute for jndi lookup. I use java bean (no EJB3), so i created annotation like this:

      @Target(FIELD)
      @Documented
      @Retention(RUNTIME)
      @Interceptors(JndiInterceptor.class)
      public @interface Jndi
      {
       String value();
      }
      



      and i think interceptor class should be like this:
      public class JndiInterceptor {
      
       @AroundInvoke
       public Object jndiLookup(InvocationContext invocation )throws Exception{
       ....................
       return invocation.proceed();
       }
      }
      



      but it doesnt work,:...( can anyone help?

      many thanks in advance