Book's Upgrade: Migrating from Spring Boot 2.5 to 2.6

Book's Upgrade: Migrating from Spring Boot 2.5 to 2.6

This chapter describes how to upgrade the book’s source code to Spring Boot 2.6.2 and Spring Cloud 2021.0. Good news: a very simple update this time, I didn’t need any changes apart from the version updates.

Table of Contents

Good news: a very smooth upgrade

The last upgrades (check the list of additional chapters) introduced some breaking changes in the book repositories. This time you only need to update the versions to make the code work with the latest releases.

This has been quite surprising for me since a new major version of Spring Cloud, 2021.0, has been released, and it’s needed to run Spring Boot 2.6. Luckily, the breaking changes don’t apply to the features and modules used in this microservice architecture.

This is a practical approach to migrating a Spring Boot project from version 2.5 to version 2.6 and Spring Cloud 2021.0. It uses the codebase from the Learn Microservices with Spring Boot book's practical example, but it applies to other projects too. If you want to dive into how Spring Boot works and set up a complete microservice architecture, get a copy now. You can also visit the book's main page for more details about the contents and extra chapters.

We’ll take as a baseline the last changes to upgrade the projects to Spring Boot 2.5. The new source code is available on GitHub (while you’re there, give it a star!).

Migrate to Spring Boot 2.6.2 and Spring Cloud 2021.0

First, we update the pom.xml files in all the Spring Boot projects. See Listing 1 as an example (multiplication service).

  • The version of the spring-boot-starter-parent dependency has been set to 2.6.2. All the library dependencies will be also upgraded following this parent pom.
  • The project version has changed to 2.6.2-SNAPSHOT to make it consistent with our previous versions of the projects.
  • We upgraded Spring Cloud to the latest version, 2021.0.0.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi=""
        <relativePath/> <!-- lookup parent from repository -->
    <description>Multiplication Microservice - Learn Microservices with Spring Boot - Upgrade 2.6.2</description>


        <!-- ... they remain the same, versions are updated because of the parent -->        

Listing 1. Upgrading Spring Boot and Spring Cloud

A minor remark: an annoying stack trace on MacOS

After this update, I see a long stacktrace in the Gateway service with a message as summarized in this excerpt:

i.n.r.d.DnsServerAddressStreamProviders  : Unable to load io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider, fallback to system defaults. This may result in incorrect DNS resolutions on MacOS.
Caused by: java.lang.UnsatisfiedLinkError: 'io.netty.resolver.dns.macos.DnsResolver[] io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider.resolvers()'

You only see this message if you’re running the project in MacOS. It seems that this issue has been always there but its logging level was promoted in one of the latest versions. Now we see it in the console. It doesn’t have any impact on the running microservice though.

For more details about this topic, see:



That’s all, a very simple update this time. You can rebuild the Docker images and boot up the entire system in containers if you want. Use the updated docker-compose.yml file pointing to the new image names.

If you still don’t have the book, I strongly recommend you get your copy now. I keep updating the book’s source code and will be sharing more content around the same use case.

The book's source code with all the updates is available on GitHub: U.2.6.2. While you are there, please give it a star!
Learn Microservices with Spring Boot - Second Edition
Moisés Macero's Picture

About Moisés Macero

Software Developer, Architect, and Author.
Are you interested in my workshops?

Málaga, Spain