We will be using Spring Boot to create services. Our initial idea would be that each service (not necessarily microservice) would be self-contained, and deployed as a .jar file. Maven for build.
I'm wondering what would be a good Spring Boot project structure, as each service would be self-contained, but I'm guessing services will still have some code/entities that can or should be reused between services
Options:
Each service is a standalone Spring Boot project. Implements only the entities, controllers, and utils that the actual service requires.
Good: each service is fully self-contained
Bad: what about custom utility classes that need to be re-used between services? What about domain objects that services may need to share?
All services are created in the same codebase. All services can re-use utilities, controllers, etc. from all other services Good: easy re-use Bad: A JVM is now able to serve all service calls? service boundaries are now handled by load balancers?
Thanks for any help!
Place common logic into separate thin JAR, place it in your artifact repository and version separately from services. This common library/ies will live it's life as standalone projects (similar to other JAR dependencies you use in your project).
Each service will use this JAR/s as normal dependency.
I was working in team, where we used this approach for:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With