cancel
Showing results for 
Search instead for 
Did you mean: 

How to use activiti:delegateExpression to wire a spring bean

vincent-kali
Star Contributor
Star Contributor

I want to use a Spring bean as a java-delegate in my Service task.
The java-delegate is defined in Spring context file:

<bean id="myJavaDelegateId" class="my.package.myJavaDelegate" init-method="init">
</bean>

Task is defined in BPMN this way:
<serviceTask id="myServiceTask" name="My Task" activiti:delegateExpression="myJavaDelegateId">
</serviceTask>

When task is executed, I got the following error:
"Delegate expression myJavaDelegateId did neither resolve to an implementation of interface org.activiti.engine.impl.pvm.delegate.ActivityBehavior nor interface org.activiti.engine.delegate.JavaDelegate"

It seems that the Spring bean is not resolved at runtime (I got the same result when using a fake bean id in BPMN).

Any idea ?

Thanks.

1 ACCEPTED ANSWER

vincent-kali
Star Contributor
Star Contributor

Here is the solution:

https://stackoverflow.com/questions/7899790/calling-spring-bean-from-alfresco-activiti-process

Bean id must be added to the config of activitiBeanRegistry that define the list of visible beans in expressions.

I did not found anything about this in activiti doc.

Is this needed only when activiti is integrated into Alfresco repo ?

View answer in original post

1 REPLY 1

vincent-kali
Star Contributor
Star Contributor

Here is the solution:

https://stackoverflow.com/questions/7899790/calling-spring-bean-from-alfresco-activiti-process

Bean id must be added to the config of activitiBeanRegistry that define the list of visible beans in expressions.

I did not found anything about this in activiti doc.

Is this needed only when activiti is integrated into Alfresco repo ?