Field Injections

Is field injection like a local variable? Can we apply same field injection in different service tasks? If yes, how do we do that?

Hello @mlvka ,

field injection sets a value to the implementation of the service task for example.

So, the lifecycle of the service task implementation is applied.

This is why we would not recommend it for Spring Boot, as all beans are application scoped by default which could lead to side effects.

What would you like to achieve with field injections?

Jonathan

What is field injection? Why is it named so? When is it used ? Can you help me out to know more about field injections?

Hello @mlvka ,

the concept of injection comes from Java Enterprise.

It means that a java bean needs other beans to fulfill its business logic.

Instead of instantiating them themselves, it just creates fields and declared them to be injected.

The reason is that the lifecycle of the bean is controlled somewhere else.

Please find an article about it here:

This is why the name is field injection.

In case of Camunda 7, field injection uses also declared fields and sets them to the values being injected.

I hope this helps

Jonathan