Summary
In this chapter, we examined the packaging structure of our application and analyzed the services and dependencies in our banking-legacy-rest
and banking-domain
projects. We realized that UserService
was not following the single responsibility principle and had two distinct responsibilities: user profiles and authentication. Based on this, we refactored the authentication responsibilities of UserService
in AuthService
, placing AuthService
into its own project, along with TokenAuthenticationFilter
. As both UserService
and AuthService
depend on User
and UserRepository
, we also placed User
and UserRepository
into their own project called user-core-domain
. This allowed us to separate our concerns into two microservices, user-rest
and account-rest
. We then learned how to use two separate databases in our microservices to enable us to have a separate database for each microservice, as well as a shared database for authentication. Finally, we learned how to define container images...