ops4j / org.ops4j.pax.cdi

Contexts and Dependency Injection for OSGi
Apache License 2.0
34 stars 26 forks source link

Global interceptors are not enabled with PAX CDI [PAXCDI-214] #259

Open ops4j-issues opened 8 years ago

ops4j-issues commented 8 years ago

Antonin Stefanutti created PAXCDI-214

While local interceptors enabled in the beans.xml descriptor work as expected, global interceptors enabled with the @Priority annotation (introduced in CDI 1.2) do not work.

For example, if a CDI extension provides a PAX CDI capability and defines a global interceptor, that interceptor should be enabled in the bundle that requires the capability.

Such an example can be found in Metrics CDI that is tested in conjunction with Camel CDI in the following test case: https://github.com/astefanutti/camel-cdi/blob/46b85ff7830f57c3ad9ea8d8a1dd6ae157841bf1/envs/osgi/src/test/java/org/apache/camel/cdi/osgi/MetricsPaxExamTest.java.

That test fails if the code in the tested sample https://github.com/astefanutti/camel-cdi/blob/c653850ac7a8610721610e8fe37cc5934277ff8d/samples/metrics/src/main/java/org/apache/camel/cdi/sample/metrics/UnreliableService.java#L33 is replaced with a global interceptor.


Affects: 1.0.0.RC1 Votes: 0, Watches: 1

ops4j-issues commented 8 years ago

Antonin Stefanutti commented

After further investigation, it happens that this is actually a side effect of PAXCDI-216 .

Having PAXCDI-216 fixed enables global interceptors to work as expected in PAX CDI.