The camunda-engine-cdi library exposes CDI beans via Expression Language, using a custom resolver. This makes it possible to reference beans from the process:

    1. <userTask id="authorizeBusinessTrip" name="Authorize Business Trip"
    2. camunda:assignee="#{authorizingManager.account.username}" />

    Where “authorizingManager” could be a bean provided by a producer method:

    1. @Inject
    2. @ProcessVariable
    3. private Object businessTripRequesterUsername;
    4. @Produces
    5. @Named
    6. public Employee authorizingManager() {
    7. TypedQuery<Employee> query = entityManager.createQuery("SELECT e FROM Employee e WHERE e.account.username='"
    8. + businessTripRequesterUsername + "'", Employee.class);
    9. Employee employee = query.getSingleResult();
    10. return employee.getManager();
    11. }

    We can use the same feature to call a business method of an EJB in a service task, using the camunda:expression="${myEjb.method()}"-extension.Note that this requires a @Named-annotation on the MyEjb-class.

    原文: https://docs.camunda.org/manual/7.9/user-guide/cdi-java-ee-integration/expression-resolving/