Spring bean injection problem in Flowable service task

Solution 1:

While I can not answer your question, the following works fine for me:

public class SomeDelegate implements JavaDelegate {

    @Autowired
    private SomeBean bean;

    @Override
    public void execute(DelegateExecution execution) {
        System.out.println(this.bean);
    }
}

The class is then used in the process via flowable:class="packages.SomeDelegate"

But, be aware, that you may have problems with autowiring dependencies in the SomeBean bean. This dependencies are not injected when using the flowable:class attribute. In order for this to work you have to make the SomeDelegate a actual bean itself (e.g. via @Service) and use it in your process definition via flowable:delegateExpression="${someDelegate}"

Example:

@Service("someDelegate")
public class SomeDelegate implements JavaDelegate {
...

and

<serviceTask id="doSomething" name="Do Something" flowable:delegateExpression="${someDelegate}"/>