Microservices with Spring-Boot and Release Management - spring-boot

Looking for advice in how to do release management of microservices built with Spring Boot.
Most projects I've worked use the release plugin (maven) to create tags as well as to release maven projects (jar, war, rpm). Usually, this relies on the maven parent/child relationship for all sub-projects (jars, wars) during the release process (monolith source code, all living in a single git repository). I'm wondering how do people maintain different boot projects (microservices) and make releases.
The way I see it, the following are possible strategies:
One Spring Boot project (microservice maven project) per git repository so that releases are managed independently.
A Multi-Module maven project with each module being a microservice. All submodules (microservices) will have to be released together. The parent pom will have to use a Boot's parent pom.
Rely on the maven-release-plugin ability to release only certain sub-modules based on a release. This will make each maven sub-module have different versions (potentially).
What has your team found useful? I like Boot's programming model, but I'm hopeful I can use a release strategy that is consistent with Boot model of keeping things simple.

Just to close the loop on this, I'm using option 1. While having multiple repositories may seem like a lot, implementing a microservices architecture precludes a good devops process to make this release management process simpler.

Related

why are the github projects of spring-boot-starter projects empty?

On looking at the spring-boot-starter-web, spring-boot-starter-security projects on github, i find them to be empty with just a build.gradle file present there.
I hope this is as expected, but this leads me to understand where the actual source code can be found. And I use maven, so I was expecting atleast a pom.xml in these projects. But since it is not present, I am wondering how spring boot team publishes there artifacts to maven central repo.
I hope this is as expected
This is as expected. Spring Boot's starter modules exist purely to being multiple dependencies together into a convenient "package". For example, if you want to write a Servlet-based web application using Spring MVC and Tomcat, a single dependency on spring-boot-starter-web provides all of the dependencies that you need. You can learn a bit more about the starters in the reference documentation.
Where the actual source code can be found
The majority of the code can be found in spring-boot-autoconfigure. For more production-focused features, you'll also find some code in spring-boot-actuator-autoconfigure. The code in these two modules is activated automatically when the dependencies that it requires are on the classpath. You can learn more about this conditional activation and auto-configuration in the reference documentation.
And I use maven, so I was expecting atleast a pom.xml in these projects. But since it is not present, I am wondering how spring boot team publishes there artifacts to maven central repo.
Spring Boot is built with Gradle which, unlike Maven, completely separates the configuration needed by the build system to build the project and the information needed by a build system to consume the project. The build.gradle files provide all of the information that Gradle needs to build the project. As part of this, it generates Gradle module metadata files and Maven pom.xml files that contain all of the information needed to consume the project with Gradle and Maven respectively. These generated files are then published to Maven Central alongside the jar files, source code, etc.

Can we use Springboot with multimodule for microservices

As Springboot multimodule produces single fat jar will that be good idea to use spring boot multimodule project for microservices
Yes, Actually it is a very good idea to use the multimodule project.
Below are some advantages of that:
Gives clarity about the code and project module
Decouples the layer.
Easy to modify/add the module. Suppose your persistence module is already implemented with Couchbase and now you wanted to switch to Mongo DB then you just need to change the persistence module(dependency, code, configuration) not other parts of a project.
Easy to maintain.
No, I believe. Actually, it is bad design to generate single fat jar for multimodule project in Spring Boot. Suppose, we have multimodule project having 3 sub-modules for different microservices. Then each module will have its individual pom right? that we need to refer in main project's pom as module. Now, assume anyhow we are able to define packaging in main module pom as single fat jar for all the sub-modules. Then, you are not following the microservices architecture guidlines. It will be a kind of monolithic architecture, because all your services are there in a single unit (a jar). Although it would be easy to maintain, but difficuilt to configure through Jenkins pipelines. I mean you have to customize your Jenkins pipelines.
You may refer following url for more details : https://thebasictechinfo.com/spring-boot/spring-boot-microservices-architecture-spring-cloud-netflix-oss

Is there any particular reason why Spring boot starters using Maven? Is it straightforward to use gradle for custom starter with artifactory?

I am trying to balance time and avoid stepping on mines, on one side we have artifactory which is gradle based and need corresponding work to integrate with maven/gradle plugin(preferably with latter as most of our projects are gradle based) on another side all spring boot default starters in source are pom.xml + I only found single gradle custom repo:
https://github.com/web3j/web3j-spring-boot-starter in several pages of search results which uses gradle. But the build file looks pretty convoluted and includes a lot of maven parts.
I am happy to invest time into gradle if someone gives a green light with example/guide/share experience. Thanks. Just to understand if there is some particular reason why the situation is like that or I am afraid of ghosts?
A Spring Boot starter is a jar file containing some compiled classes and, typically, a META-INF/spring.factories file that lists some auto-configuration classes. As such, they can be built equally well with Maven or Gradle. Spring Boot's own starters are built with Maven purely because that's the build system that the whole project uses. If we were starting again from scratch now, we'd probably chose Gradle over Maven.
Some of the third-party starters listed here are build with Gradle, for example:
azure-application-insights-spring-boot-starter
charon-spring-boot-starter
session-couchbase-spring-boot-starter

Is Spring tightly coupled with maven

Is Spring tightly coupled with Maven ? Most of the examples in the internet shows Spring and Maven to configure spring dependent jars, this post explains so many cons of Maven. All commercial projects are should to be using only this combination ?
Please explain
Thanks
Both of them serve different purposes, Spring examples use Maven because maven is highly adopted as a build, dependency management framework. That has nothing to do with Spring coupling with Maven. Spring is a framework to build enterprise applications and Maven is a build and deploy tool.
You can use Gradle, ivy or even manually download the libraries instead of relying on Maven as the dependency management framework.
No. You can use whatever you want to build your Spring-based app. BTW, all the Spring tutorials show examples using Gradle (that Spring also uses internally).
What is true, though, is that Spring jars are available from the Maven central repository and the Spring repository, and that their dependencies is thus described in a Maven pom.xml file. But nothing prevents you from downloading the required jars manually and add them in the classpath.

Pulling out domain classes from a Spring Roo project

We need to be able to pull out domain classes (i.e. entities) from a Spring Roo project in order to reuse them for a Spring Batch project.
Is this possible?
Bearing in mind that we rely on Maven as our build and dependency management tool, and that our Roo project is already created, can we switch to a multi-module architecture?
If so how?
I don't think there is a roo command for converting a single module maven project to a multi module project.
One option would be to use roo to create a separate persistence module in your current project and manually migrate your entities and configuration over.

Resources