Basically, I need a way to disable one (framework supplied) @Produces
method in favour of using my own @Produces
method.
More specifically, I'm working with jBPM 6 and attempting to get it working correctly inside a container. The HumanTaskServiceProducer
uses the drool's EnvironmentFactory
, which always generates a new Environment
. The code for caching the Environment
in that EnvironmentFactory
is commented out for some reason.
This means that jBPM picks up the JTA transaction manager rather than the Container transaction manager. I'm trying to supply my own producer for the task service that correctly sets the environment instead of using the default one.
Does anyone know of a way to specify a producer to use? In hope I tried specifying it as an @Alternative
, but that doesn't seem to have worked. Either that, or a way to specify the environment on the HumanTaskServiceProducer
.
If you use CDI 1.0, alternatives don't work across different bean archives.
Otherwise (in CDI 1.1+) be careful to activate your alternative as specified here.
The best solution for you is probably to specialize your producer. You'll have to:
@Specializes
.You'll find all the info on producer specialization in the spec.
If you can't use specialization, your last solution is to create a portable extension that exclude the class containing the original producer from bean discovery (create a observer on ProcessAnnotatedType
event and call the veto()
method on the event) so your producer will not be in conflict with the original one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With