We are using Custom Java Service Tasks and wish to access Spring Beans defined in the Spring Application Context from within the Java implementation classes. However, currently the Custom Java Service Tasks are not invoked as Spring Beans by the engine, and we are looking for a good way to access Spring beans from within the implementation class. Activiti Documentation describes that when using a Service Task, we can use "activiti:class" or "activitie:delegateExpression" as the target for invocation. See the two statements below illustrating the example: <serviceTask id="serviceTask" activiti:delegateExpression="${archiveBean}"/>
<serviceTask id="servicetask1" name="Archive" activiti:class="com.test.Archive"></serviceTask>
The custom Java Service Tasks produce the 'activiti:class' statement and do not seem to give the option of specifying 'activiti:delgateExpression' – which would have allowed us to access Spring context. Per documentation, the custom Java Service Task implementation classes have to implement AbstractCustomService Tasks, and we have to specify the delegation class using the Rumtime annotation (see below):
@Runtime(delegationClass = "com.test.Archive")
public class CustomArchiveTasks extends AbstractCustomServiceTask {
It seems that the @Runtime annotation only has one property/attribute "delegationClass". If there was a "delegateExpression" attribute, that would allow us to specify the delegation as a Spring bean. So my questions are: (i) Is there a way to specify the CUSTOM Java Service Task implementation delegate as a SPRING bean(ii) alternatively, what might be another way to access the Spring context from within the implementation of the Custom Java Service Task?