RND-38: implement initial Spring Boot project with 3 layered architecture #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implementing an example of 3 Layered Architecture using Spring Boot 3.
The application golden-example consists of next sub-modules:
On the other hand service and repository modules also contain an api and impl submodules.
In the api modules, we have only interfaces defined for importing into the higher modules (like service-api module was imported into the controller module) which allows us to restring access from higher modules to actual implementation forcing them to use interfaces instead.
This structure allows us dynamically switch the implementation of some specific modules without changing higher modules.
In this project, we can easily change between different implementations of the repository layer which allow us to migrate, for example from using MySQL DB and JPA implementation to Postgres DB and JOOQ implementation by just changing the profile from mysql-jpa-repository to postgres-jooq-repository in
application.yaml
or with the appropriate property during startup.The project also contains docker folder with
docker-compose.yaml
file for easily spinning up DBs locally for testing.For starting the application we have exe module which contains all submodules from the application for adding them to jar and context.