From the course: Learning Quarkus

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Dependency Injection in Quarkus

Dependency Injection in Quarkus

From the course: Learning Quarkus

Start my 1-month free trial

Dependency Injection in Quarkus

- [Instructor] No discussion of Quarkus would be complete without a discussion of the dependency injection strategy for the framework as a whole. Dependency injection is a different way of dealing with the constructs of control. Instead of you managing the state of the classes that are part of your application, you allow the container to manage them. Let's take a look at how this works. First and foremost, we start with our container. Now this is any web application, any batch job, any container whatsoever, as long as Quarkus is controlling it. Now we're going to imagine that our container manages several classes or beans, as they become defined, once they are part of Quarkus. Now, one of our classes needs a dependency. With traditional dependency management, you would create the object you need in your class, but instead we will define it so the container can create it. Then, you allow the container to inject the class…

Contents