Flowable delegateExpression in service task is not working

1.1k views Asked by At

The flowable version which I'm using is 6.4.1.

@Component

public class MyClass implements JavaDelegate {

    @Autowired
    private MySampleService mySampleService;

    @Override
    public void execute(DelegateExecution delegateExecution){
        sampleService.doSomeTask();
    }
}

Here, myClass bean would be created for class MyClass. Hence, in the bpmn, I can use it like flowable:delegateExpression="${myClass}".

But I'm getting error

"unknown property used in expression: ${myClass}"

And without delegateExpression, mySampleService would be null.

Any suggestions?

1

There are 1 answers

0
Ashmita Sinha On BEST ANSWER

There are two ways to configure flowable:

  1. Manually - When using ‘regular’ Spring, you also need to register the ProcessEngineFactoryBean. This will take the engineConfiguration and create a SpringExpressionManager (https://github.com/flowable/flowable-engine/blob/master/modules/flowable-spring/src/main/java/org/flowable/spring/SpringExpressionManager.java) that has access to the expression manager.
  2. SpringBoot, provides out of the box configuration. One only need to provide the needed beans, like DataSource, AsyncExecutor, etc. (based on you the scenario) and spring boot will take care of the rest.