Hi,
i use @Postconstruct in interceptor like followed:
@Target(TYPE) @Documented @Retention(RUNTIME) @Interceptors(KleberInterceptor.class) public @interface Kleber { String value() default ""; }
@Interceptor public class KleberInterceptor { @PostConstruct public Object jndiLookup( InvocationContext invocation ) throws Exception {
Unfortunately it not works in Seam 2.2.0.GA. The @PostConstruct methode will nover be invoked.
After debuging Seam resource codes after something like this:
private void callPostConstruct() { final Component component = getComponent(); if (!component.hasPostConstructMethod()) { return; } InvocationContext context = new RootInvocationContext( bean, component.getPostConstructMethod(), new Object[0] ) { @Override public Object proceed() throws Exception { component.callPostConstructMethod(bean); return null; } }; invokeAndHandle(context, EventType.POST_CONSTRUCT); }
here Component is the intercepted seam component, if this component doesnot has owned Postconstruct method , invokeAndHandle() will never reached.
But, the seam document says lifecycle methods will be supported on both component and interceptor...
so, i would like to ask : if the feature @Postconstruct on intercepter is removed or it is just a bug?
thanks