springboot-how to solve conflict and compatibility of spring-boot versions?

1. Purpose

In this post, I would demo how to solve the conflict and compatibility of spring-boot versions when we only want to import part of the spring boot dependencies to our project.

2. The reason and solution

With the prevalence of microservices, the popularity of spring boot has become a household name. But at the same time, with the rapid iteration of spring boot, many versions have appeared. For example, 2.4.x-SNAPSHOT/ has been launched. Different versions of spring boot have requirements for the versions of spring components and third-party components that are used together.

image-20210322211910254

In our usual development, when we need to integrate certain spring boot functions, we occasionally encounter package version conflicts. Although we know the version conflicts, we don’t know which version to use? At this point, if we can query the corresponding version of the conflicting package according to the version of spring boot we use, the problem will be resolved quickly.

We discovered that when spring boot actually released each version, it would additionally explain the compatible version of the relevant package. For example, the following address:

https://docs.spring.io/spring-boot/docs/2.4.2/reference/htmlsingle/#dependency-versions-coordinates

image-20210322210747301

This address shows the version number of each dependency package compatible with spring boot 2.4.2, you can change the version to the specific spring boot version you are using.

So ,the spring boot dependency versions URL format is: https://docs.spring.io/spring-boot/docs/theversion/reference/htmlsingle/#dependency-versions-coordinates

You can replace the theversion with the actual version name of spring boot release, to check all the versions of spring boot, you can goto this URL:

https://github.com/spring-projects/spring-boot/tags

image-20210322211258794

For example, you want to check the v2.3.9.RELEASE’s dependency, you can navigate to :

https://docs.spring.io/spring-boot/docs/2.3.9.RELEASE/reference/htmlsingle/#dependency-versions-coordinates

3. Summary

In this post, we demonstrated how to check the dependency versions of each spring boot releases. Actually you can goto spring boot documents to check all the dependency versions. There is a trick in it. Thanks for your reading. Regards.