AnsweredAssumed Answered

Using Spring Beans

Question asked by msatti on Jan 16, 2019
Latest reply on Jan 16, 2019 by msatti

Hi all,

 

I'm fairly new to Activiti so apologies if this is basic.

 

I have a class implementing the JavaDelegate interface, but it also has an @Autowired bean inside it (it is a class annotated with @Service). I read that since I am autowiring, you can't specify it as an activiti:class inside the service task, you have to bind it using activiti:delegateExpression.

 

I have my implemented class as:

@Component("myDelegate")
class MyDelegate implements JavaDelegate {
    @Autowired
    MyCustomService myCustomService;

    ...
}

 

and I have defined the service task as:

<serviceTask id="servicetask1" name="Service Task 1" activiti:delegateExpression="${myDelegate}"></serviceTask>

 

However when I go to run the process, I get a runtime error saying:

 

org.activiti.engine.ActivitiException: Unknown property used in expression: ${myDelegate}

 

Is there something else I need to do?

 

If possible, I was hoping there was a solution that only used annotations rather than .xml bean definitions

Outcomes