Issue
Im currently starting to develop a new project for my masters final thesis which will be a monolith to microservice kinda project ( very briefly ).
Since my team already has a defined architecture for all the backend applications ( they are currently monoliths ), is there a way I can "quickly" create a generator with the already defined architecture for the new microservices?
In can this cannot be possible, Im thinking on just creating a blank base project that woud be the starting point for any microservice in the team.
Solution
I would say the solution will depend on what is your "blank base project" structure. I can think of two possibilities that might fit your requirements.
If you only need to configure certain aspects of the project, such as its Maven coordinates, build tool, java version and Spring Boot Starters dependencies, then you don't need a base project at all. Spring Initializr project is made for you. Spring Initializr is a popular service and even a library that you can use and extend for your own needs.
You can customize the Spring Initializr service for your own needs, however It isn’t a straightforward path. You can see how to create your own service here.
I also have created my custom one following the same guide. I used a copy of the official service application.yml, I added my custom starters and implemented my own InitializrMetadataUpdateStrategy
to exclude Spring snapshots.
If you are using Maven then you could create a Maven archetype, I think it will be easier than dealing with Spring Initializr customization.
A Maven archetype is an abstraction of a kind of a project that can be instantiated into a concrete customized Maven project. In short, it's a template project template from which other projects are created.
This guide will teach you how to create a custom archetype and then how to use it to generate a Maven project through the maven-archetype-plugin.
Answered By - eHayik
Answer Checked By - Katrina (JavaFixing Volunteer)