java – Creating a common spring boot project with auto generated code
This sounds like a good use case for creating a maven archetype if thats your build system of choice. If not, Gradle doesnt seem to have an analog of that concept.
Ive never tried to setup a template as a dependency so Im not sure how well that would work out, but what Ive done in the past is just setup a git repo that has all of the boilerplate code like youre talking about, and then cloning and adapting to the specific project. The added benefit to this is that I can update the template (like for bug fixes) independently of the projects that use it, merge in those changes, test for breaking changes, and redeploy.
You may also be interested in JHipster, which is a project generator with lots more bells and whistles (Im not associated). I havent used it that much, but the project has a huge following.