Transforming ports, use cases, and adapters into CDI beans
When designing the Application hexagon for the topology and inventory system, we defined the use cases as interfaces and input ports as their implementations. We also defined output ports as interfaces and output adapters as their implementations in the Framework hexagon. In this section, we’ll refactor components from both the Application and Framework hexagons to enable the usage of dependency injection with Quarkus DI.
The first step to working with Quarkus DI is to add the following Maven dependency to the project’s root pom.xml
:
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-resteasy</artifactId> </dependency>
In addition to the RESTEasy libraries, this quarkus-resteasy
library also provides the required libraries to work with Quarkus DI.
Let’s start our refactoring efforts with the classes and interfaces related...