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