Adding a Repository component
We'll use the bottom-to-top approach to add a @Repository
component. Let's start implementing the domain layer with a @Repository
component. We'll implement the service and enhance the Controller
component in subsequent sections accordingly. We will code the @Repository
component first, then use it in the @Service
component using constructor injection. The @Controller
component will be enhanced using the @Service
component, which will also be injected into the Controller
using constructor injection.