AnsweredAssumed Answered

Accessing annotated spring beans in an expression

Question asked by ikazarno on Oct 13, 2013
Latest reply on Oct 15, 2013 by ikazarno

today is a first day I’m experimenting with activiti. It seems to be a nice framework, thanks guys :)

I have a problem accessing an annotated spring bean in a service task expression:

<serviceTask id="servicetask" name="Service Task" activiti:expression="#{myService.performAction()}"></serviceTask>

My service bean looks as follows:

public class MyServiceImpl implements Serializable {
  public void performAction() {
    // some business logic

My Unit Test Code:

public class MyWorkflowTest {

   public ActivitiRule activitiSpringRule;

   public void testMyProcess() {
      RuntimeService runtimeService = activitiSpringRule.getRuntimeService();

If I execute the test I get following error:
org.activiti.engine.ActivitiException: Unknown method used in expression: #{myService.performAction()}
Caused by: org.activiti.engine.impl.javax.el.MethodNotFoundException: Cannot find method perform with 0 parameters in class com.sun.proxy.$Proxy25
   at org.activiti.engine.impl.javax.el.BeanELResolver.invoke(
   at org.activiti.engine.impl.javax.el.CompositeELResolver.invoke(

If I put the bean in the spring config, it works! Can I use the annotated beans, without defining them in the spring config?

Thanks in advance!