cancel
Showing results for 
Search instead for 
Did you mean: 

Invoking custom Java Service Tasks as Spring Beans

jjfutt
Champ in-the-making
Champ in-the-making
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?
2 REPLIES 2

jjfutt
Champ in-the-making
Champ in-the-making
I should clarify that our main goal is to be able to access other Spring beans from within the Java Delegate implementation. If it can be achieved in some way already, then we won't have the need to declare our Custom Java Classes as delegateExpression

trademak
Star Contributor
Star Contributor
Hi,

This feature is not yet supported. You can create a JIRA for this if you want it to be added.

Best regards,