# Field Injections

**URL:** <https://forum.camunda.io/t/field-injections/41918>\
**Category:** Community Extensions\
**Created:** [January 6, 2023, 5:22am UTC](https://forum.camunda.io/t/field-injections/41918 "2023-01-06T05:22:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mlvka](https://forum.camunda.io/user_avatar/forum.camunda.io/mlvka/32/21650_2.png) [@mlvka](https://forum.camunda.io/u/mlvka)\
**Post date:** [January 6, 2023, 5:22am UTC](https://forum.camunda.io/t/field-injections/41918/1 "2023-01-06T05:22:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jonathan.lukas](https://forum.camunda.io/user_avatar/forum.camunda.io/jonathan.lukas/32/14911_2.png) [@jonathan.lukas](https://forum.camunda.io/u/jonathan.lukas)\
**Post date:** [January 7, 2023, 7:41pm UTC](https://forum.camunda.io/t/field-injections/41918/2 "2023-01-07T19:41:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mlvka](https://forum.camunda.io/user_avatar/forum.camunda.io/mlvka/32/21650_2.png) [@mlvka](https://forum.camunda.io/u/mlvka)\
**Post date:** [January 9, 2023, 9:48am UTC](https://forum.camunda.io/t/field-injections/41918/3 "2023-01-09T09:48:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jonathan.lukas](https://forum.camunda.io/user_avatar/forum.camunda.io/jonathan.lukas/32/14911_2.png) [@jonathan.lukas](https://forum.camunda.io/u/jonathan.lukas)\
**Post date:** [January 9, 2023, 7:56pm UTC](https://forum.camunda.io/t/field-injections/41918/4 "2023-01-09T19:56:50Z")

</div>

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:

> **[Understanding Jakarta EE 8 - CDI Part 1 - DZone](https://dzone.com/articles/understanding-jarkarta-ee-8-cdi-part-1)**
>
> This article covers some of the features of CDI such as type safe annotations configuration, alternatives and more.

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

---

<div class="post-metadata">

**Author:** ![system](https://forum.camunda.io/uploads/default/original/3X/5/8/58d50142eacca605d35cb1ef9e6b86ae85f49436.png) [@system](https://forum.camunda.io/u/system)\
**Post date:** [January 31, 2024, 10:36am UTC](https://forum.camunda.io/t/field-injections/41918/5 "2024-01-31T10:36:59Z")

</div>

Closed on January 31, 2024, 10:36am UTC


