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

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


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:

public class PerformanceInterceptor implements Serializable {

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

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

Object onAroundConstruct(InvocationContext ctx) throws Exception {...}

@Target({*ElementType.METHOD*, ElementType.TYPE})
public @interface Measure {

thanx for clarification,
-------------- 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