Associate flowable task with method

Hello Readers,

Until now I’ve known that service task can be associated with a class like below,

And, the class should implement JavaDelegate interface and there should be a method called execute with DelegateExecution as it’s parameter.

Is it possible that I can associate a service task with a simple method like below??

Service Task:

public class HelloWorld {
private static final Logger LOGGER = Logger.getLogger(HelloWorld.class.getName());
public void helloWorld(){“Hello, this is working atleast”);

Ashmita Sinha

You can try setting the expression on your service task:

Hello William,

I’ve tried this,

but this gives error: Unknown property used in expression: #{helloWorld.helloWorld()}.

Which means, it is unable to get the bean and call helloWorld(). Is tere anything else which can be done?

Thanks in advance !

Ashmita Sinha


Here’s a sample app I tend to use $ as opposed to #, however either should work. In order to use expression in this way helloWorld needs to be registered as a bean.

  • The BPMN in the sample I have a service task with flowable:expression="${demoService.hello()}".
  • The DemoService is as follows:

import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;

public class DemoService {

    public String hello(){"executing DemoService.hello()");
        return "hello";


I tried the github project which you mentioned and that worked fine.

Could you please check

Error which I’m getting: org.flowable.common.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier ‘helloWorld’


I think the biggest complication in your source is that you are manually creating the process engine. I don’t think that the process engine is Spring aware when you create it this way, so it won’t know to inject named beens into the expression handling. This is the same reason that your JavaDelegate has to use class instead of delegateExpression. There are methods to add additional functions to expression handling like in ProcessEngineConfigurationImpl where we initialize the function delegates. But the simplest solution would be to import flowable-spring or flowable-spring-boot-starter and let the engine find your beans.

Here’s an example project if you don’t want to use the starter:

Additionally, it’s possible to register custom functions that can be used in expressions. See the org.flowable.common.engine.api.delegate.FlowableFunctionDelegate interface for more information.