Hi,
I recently ran into the problem of trying to integrate Flowable
into an application that uses CDI
/JavaEE
via WildFly
and Weld
rather than Spring
as its injection framework. While there is some (sparse) information about how the flowable-cdi
extension works, I still bashed my head against a wall for a long time trying to get injection of JavaDelegate
beans to work via EL. Flowable
would always tell me that "${myDelegate}"
was an unknown identifier, i.e. that bean resolution didn’t work. This was especially puzzling because normal injection of JavaDelegate
beans via @Inject
worked perfectly.
When I stumbled upon the solution by accident, namely that you have to use the named @Named
annotation in addition to a CDI
scope annotation like @Dependent
for the bean name to become visible to the EL, I felt quite frustrated that there was no example on the flowable-cdi documentation page
that highlights this issue, and the Spring
documentation is of no help either because it does not have this idiosyncrasy.
While I understand that this is a quirk of CDI
and the EL, which is documented deep inside the CDI
specification (section 10.2. “EL name resolution”), and not one of Flowable
itself, I think you would do people a big favor adding a simple example of a JavaDelegate
implementation that can be looked up in a BPMN flowable:delegateExpression
statement, like the following one, and telling them that resolution definitely needs the @Named
annotation:
@Dependent
@Named("myDelegateNameInEl") // won't be resolved in Expression Language without this
public class MyDelegate implements JavaDelegate
{
@Override
public void execute(DelegateExecution execution)
{
System.out.println("Running!");
}
}
I hope this helps someone in the future, and thanks for your hard work maintaining Flowable
!