Impacts of not using Delegate Expression for SpringBoot Java Delegate Resolution needs to be highlighted more clearly in docs!?


after reviewing docs and see the unit tests, I see that Delegate Expressions seem to be required for Spring autowiring to function.

while the example in the docs: show the usage of a expression, there is no actual explanation of the impacts of using the Expression vs not… This surely should be highlighted in MUCH more detail and made as a very visible warning.

I think this does a good explanation:, but this information should really be added into the docs in a very visible area, and should be updated in the Camunda Spring Boot examples to explain the WHY expression delegate is should be used, and if not used, what are the impacts (such as Autowiring not working within the Delegate’s execution)

Related: Can't Autowire Other Class When Using TaskListener

Same issue from years ago!topic/camunda-bpm-users/7hbfa7CuhRw

Same problem again: Depending on how the JavaDelegate class is included in the bpmn file a Spring Bean is instantiated or not

Another: @Autowire doesnt work in java delegate spring boot

Hi Stephen,

Thank you for rising this.
I create a ticket for it -

Best regards,


Clarification: “Delegate Expression” and “Expression” behave the same when it comes to injection, just “class” is different.

1 Like

Good to know! Why is delegate expression used over the expression in the examples?

typically, you use the Consumer pattern (functional interface), so it is clear that your one class for one service task will be called with the execution context (DelegateExecution).

For this use case the JavaDelegate defines the interface void/execution. It is very clear what happens and you do not have to pass the execution manually, just write ${myServiceDelegate}.

You could however also use an expression and call it via ${myServiceDelegate.execute(execution)}, which has the same effect. When doing so, you are free to pass additional parameters … we sometimes use this when we need to pass a variable value to set in the delegate …

Rule of thumb (at least for me): use JavaDelegates with DelegateExpression always, never use Class, switch to expression if you really need to.


Great explanation

@jangalinski are there other nuance usage for springboot camunda that could be documented? I am happy to update the docs, but would like to capture as many nuances as possible.

@StephenOTT: hard for me to judge … I do not have problems with the starter and the docs … but I might be biased :slight_smile:

1 Like

Well you part creator and using it from memory. It’s more about identifying and documenting those parts that are in your memory but not actually written down. The Spin plugin is another good example.

1 Like

Another case of the same issue Unable to read when invoked from Java Delegate