[
https://issues.jboss.org/browse/WFLY-5235?page=com.atlassian.jira.plugin....
]
Dirk Weil commented on WFLY-5235:
---------------------------------
I finally found some time to dig into the problem a little bit more: If the observer
method is private, interceptors are not called. With non-private methods, interceptors are
working as expected. This behaviour has changed from WildFly 8.2.0 to 9.0.1. I didn't
check WildFly 10.
I tried to find out from the specification, if interceptors should be called when invoking
private methods, but found no unmistakable statement. If someone could clarify that, I
would be very thankful.
I can imagine, that the methods intercepted must be non-private. But if that is the case,
an appropriate exception should be thrown, if they are private.
The problem can be reproduced with this demo:
https://github.com/dirkweil/wildfly-cdiscopeinit-demo. If you build the application (just
run mvn) and deploy the resulting war file onto WildFly 8, no exception arises. If using
WildFly 9 a TransactionRequiredException is thrown in the observer method
de.gedoplan.beantrial.wildflycdiscopeinit.service.InitTestDataService.createTestData.
CDI interceptors are not called when invoking observer method
-------------------------------------------------------------
Key: WFLY-5235
URL:
https://issues.jboss.org/browse/WFLY-5235
Project: WildFly
Issue Type: Bug
Components: CDI / Weld
Affects Versions: 9.0.1.Final
Reporter: Dirk Weil
Assignee: Martin Kouba
The following code runs with an active transaction on WFLY 8.2.0, but failes with an
TransactionRequiredException on WFLY 9.0.1:
@ApplicationScoped
public class InitCocktailDemoDataService
{
@PersistenceContext
private EntityManager entityManager;
@Transactional
private void createDemoData(@Observes @Initialized(ApplicationScoped.class) Object
event)
{
this.entityManager.merge(someEntity);
}
It seems that interceptors aren't called at all - at least for observers of scope
lifecycle events.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)