-
Sub-task
-
Resolution: Fixed
-
L3 - Default
-
None
-
None
Problem
- In the engine-cdi test suite, with ProgrammaticBeanLookupTest a test exists that tests if an alternative bean can be selected using the @Alternative annotation.
- The only way to select an alternative bean implementation in CDI 1.0 is to declare the bean via the META-INF/beans.xml file [1].
- In Quarkus, the content of the META-INF/beans.xml file is ignored, which means that it is not possible to select an alternative bean implementation via this file.
Solution
What Quarkus supports to specify an alternative bean implementation:
- From CDI 1.1 onwards, it is possible to define an alternative implementation programmatically via @Priority(int) annotation [3].
- Since @Priority cannot be used for producer methods, Quarkus offers the custom annotation io.quarkus.arc.AlternativePriority.
- It is possible to select an alternative bean implementation via Quarkus application.properties file and the property quarkus.arc.selected-alternatives.
You can read more about it in the official Quarkus documentation [4].
Decision
- Since our engine-cdi module doesn't make use of the @Alternative annotation, we don't need to document the alternative solutions.
- We exclude the failing ProgrammaticBeanLookupTest in the Quarkus test suite and introduce a dedicated test [5] that ensures the behavior expected in Quarkus.
[1] https://docs.jboss.org/weld/reference/1.0.0/en-US/html_single/#alternatives
[2] https://quarkus.io/guides/cdi-reference#declaring-selected-alternatives
[3] https://docs.jboss.org/weld/reference/2.2.0.Final/en-US/html_single/#alternatives
[4] https://quarkus.io/guides/cdi-reference#declaring-selected-alternatives
[5] https://github.com/camunda/camunda-bpm-platform/blob/master/quarkus-extension/engine/deployment/src/test/java/org/camunda/bpm/quarkus/engine/test/lookup/ProgrammaticBeanLookupTest.java
This is the controller panel for Smart Panels app
- is caused by
-
CAM-13562 Engine CDI module is integrated into Quarkus Extension
- Closed