[cdi-dev] Lifecycle Callback Interceptor and @Target "METHOD"

Radim Hanuš radim.hanus at gmail.com
Tue Jun 11 08:01:45 EDT 2013


Hi,

I just went through this thread and corresponding issue
WELD-1416<https://issues.jboss.org/browse/WELD-1416>and still not
clear for me

Josef Hartinger referenced a statement from the current version of spec:
"With the exception of AroundConstruct lifecycle callback interceptors, an
interceptor for lifecycle callbacks may only declare interceptor binding
types that are defined as Target(TYPE)."

but does it mean that adding @AroundConstruct callback interceptor into
class PerformanceInterceptor prevents from DefinitionException ?
or in such case there should be only @AroundConstruct defined and none of
both @PostConstruct and @PreDestroy ?

enhanced sample of Jens Schumann:

@Interceptor
@Measure
public class PerformanceInterceptor implements Serializable {

@AroundInvoke
public Object measure(InvocationContext ctx) throws Exception { ... }

@PostConstruct
public void measureCreate(InvocationContext ctx) { ... }

*@AroundConstruct*
Object onAroundConstruct(InvocationContext ctx) throws Exception {...}
}

@InterceptorBinding
@Target({*ElementType.METHOD*, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface Measure {
}

thanx for clarification,
Radim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20130611/6fa6f448/attachment.html 


More information about the cdi-dev mailing list