Using shared libraries in microservices is a bad practice. But every microservice depends on frameworks and libraries: Spring Boot, Kafka Java Client etc.
If a system consists of 30 microservices based on Spring Boot and using Gradle or Maven as a build tool and distributed as Docker images, is there an easy way to update Spring Boot version in all microservices? Updating all microservices one by one takes a lot of efforts. And the more microservices a system has, the more efforts is required.
And the reason for an update may be a security vulnerability in some of dependencies. For example, Spring Boot 2.2.0.RELEASE depends on Tomcat 9.0.27 that has vulnerability CVE-2020-1938 (just as an example). The vulnerability was fixed in Tomcat 9.0.31, so updating to Spring Boot 2.2.4.RELEASE will solve the issue.
A workaround is to declare Spring Boot version in build.gradle
as 2.2.+
. But someone still has to rebuild all microservices (e.g., on Jenkins).
Also, with this approach you loose control over version management and delegate it to Gradle (always use the latest one version possible). To still have the control over dependencies, versions can be declared in the gradle.properties
and mounted into workspace somehow by Jenkins:
spring.version=2.2.4.RELEASE
If the vulnerability is critical there is no time to wait for new Spring Boot version with a fix and Tomcat has to be updated explicitly in the build.gradle
. Or even replaced with Undertow what also requires changes in the build.gradle
.
Using standalone Tomcat instead of embedded also doesn't help much because microservices are distributed as Docker images and not as WAR files deployed to a servlet container.
In Java EE security updates in theory was super easy. You update an application server (e.g. WildFly) or apply a security patch and if application uses only Java EE API, no further action is required. Is there a similar concept of easy dependencies updates for microservies (at least in theory)?