The fundamental purpose of a software developer is to write code that is:

  • Easily maintainable and testable.
  • Loosely Coupled.
  • Easily extensible.

Building a distributed Java enterprise application required huge understanding in wiring various mainstream technologies across various application tiers, tying web controllers to database backend through a series of application and business services. This made it difficult to achieve the points highlighted above, making it a huge learning curve for developers to do what they do best: to write code.

Context and Dependency Injection (C.D.I) is one such technology that was introduced in Java EE 6 (JSR 299), with the goal to help knit the web tier with the transactional tier.

The Jakarta EE 8 CDI specification version is CDI 2.0, which is an update to CDI 1.2 (JSR 346).

Dependency Injection

According to Wikipedia:

In software engineering, dependency injection is a technique in which

an object receives other objects that it depends on. These other

objects are called dependencies. In the typical “using” relationship

the receiving object is called a client and the passed (that is,

“injected”) object is called a service.

Dependency Injection helps eliminate the need of hard-coding dependencies (object creation and instantiation), thus making our application loosely coupled, maintanable, extendable, and easier to test. With CDI, dependency resolution is done on runtime. The DI container (the injector) is responsible for injecting dependent beans.

#java (programming lang... #jakarta ee #cdi 2.0 #jakarta ee 8 #java

Understanding Jakarta EE 8 - CDI
2.90 GEEK