This content has been marked as final.
Show 4 replies
-
1. Re: @Startup and Seam interceptor
jacob.orshalick Nov 29, 2007 10:34 AM (in response to xinhua)Does your interceptor work with other Seam components that are not annotated with @Startup? Please post your annotation and interceptor code.
-
2. Re: @Startup and Seam interceptor
xinhua Nov 29, 2007 10:48 AM (in response to xinhua)hi,
yes, interceptor works fine with other component without @Startup
At first, i have two annotations@Target(TYPE) @Documented @Retention(RUNTIME) @Interceptors(KleberInterceptor.class) public @interface Kleber { }
interceptor is supposed to check filed with @Jndi annotation and take the string from @jndi for jndi lookuppublic class KleberInterceptor { @PostConstruct public Object jndiLookup(InvocationContext invocation )throws Exception{ Object target = invocation.getTarget(); Field[] fields = target.getClass().getDeclaredFields(); try{ InitialContext ctx = new InitialContext(); for(Field field: fields){ Jndi jndi = field.getAnnotation(Jndi.class); if(jndi!=null){ Object obj = ctx.lookup(jndi.value()); field.setAccessible(true); field.set(target, obj); } } }catch(Exception ex){ ex.printStackTrace(); } return invocation.proceed(); } @AroundInvoke otherMethods............ }
I can not use @Kleber on a component which already has a @Startup, what i can do now ,is to write jndi lookup codes directly in @Startup component, and it works.....
is there any better way to inject jndi resouce in @Startup Seam component? -
3. Re: @Startup and Seam interceptor
pmuir Nov 30, 2007 7:06 AM (in response to xinhua)So how does it not work? Does the interceptor run? Does it run and not set the values?
-
4. Re: @Startup and Seam interceptor
xinhua Nov 30, 2007 11:31 AM (in response to xinhua)"pete.muir@jboss.org" wrote:
So how does it not work? Does the interceptor run? Does it run and not set the values?
nothing happened. @Startup is ignored also. Interceptor does not run.
i put a @Create in this @Startup seam component, if my annotation @Kleber is there, @Create function doesnt run, the compoent wont be created by deployment.
I donot know how to debug a @Startup Seam component :(