users@ejb-spec.java.net

[ejb-spec users] Re: [jsr345-experts] Re: Interceptors 1.2 MR candidate is available for the final review

From: <asbriglio_at_cesi.fr>
Date: Fri, 12 Apr 2013 14:57:46 +0000 (GMT)

Hi Antonio,
What I understand from the spec is we should not define an
AroundConstruct method IN your target bean.
So I would say that in your second sample code, the interceptor applied
on the findCustomerById method will invoke the AroundConstruct-annoted
method:
public class CustomerService {
  public void createCustomer(Customer customer) {...}
  @Interceptors(LoggingInterceptor.class)
  public Customer findCustomerById(Long id) {...}
}
 It’s what I understand from the assertion:
The AroundConstruct interceptor methods may be only defined on
interceptor classes and/or superclasses of interceptor classes. The
AroundConstruct callback should not be defined on the target class.
(p.14)

So for me:
public class CustomerService {
  public void createCustomer(Customer customer) {...}
  @Interceptors(LoggingInterceptor.class)//AroundConstruct invoked
  public Customer findCustomerById(Long id) {...}
        
@AroundConstruct //we should not do this.
public void construct(InvocationContext ctx)throws Exception {...}
}

Best Regards,
Alex