I guess I found the answer by studying the interceptors spec. It states that
"The PostConstruct and PreDestroy, annotations are used to define an interceptor
method for a lifecycle callback event."
I assume that those are really only meant for 'lifecycle callback events' and must
_not_ get invoked if they got called manually.
Thus postConstructInterception will also get called for the private method but NOT for a
manual invocation if the doTheInit would be public.
Is this interpretation correct?
Can we have a TCK for it? :D
LieGrue,
strub
----- Original Message -----
From: Mark Struberg <struberg(a)yahoo.de>
To: cdi-dev <cdi-dev(a)lists.jboss.org>
Cc:
Sent: Saturday, January 5, 2013 2:56 PM
Subject: [cdi-dev] intercepted private @PostConstruct method behaviour?
Hi folks!
What happens if I have a
@Transactional
public class MyService {
@PostConstruct
private void doTheInit() {...}
Where the interceptor looks like
@Interceptor @Transactional
public class TransactionalInterceptor {
@PostConstruct
public void postConstructInterception(InvocationContext ic) {..}
Question a.) does the @Transactional interceptor still apply to the _private_
doTheInit() method?
Question b.) consider the doTheInit() method being changed to public and it will
get invoked by a user. Does the postConstructInterception still get invoked? Or
must it only get invoked for _real_ PostConstruct actions triggered by the
container?
LieGrue,
strub
_______________________________________________
cdi-dev mailing list
cdi-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/cdi-dev