Remember a springboot upgrade

Let me talk about the background first, because to use a springcloud component, springboot 2.1.17 must be upgraded to springboot 2.6.15 from the corresponding version.

first step

Replace parent

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.15</version>
    </parent>
<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>5.3.8</version>
        </dependency>

Those who are more stupid think that this is the end, start it directly and find an error.

org.springframework.core.metrics.ApplicationStartup

Faced with this error, I did the following:

  1. Check which package ApplicationStartup is under and import it.

  2. Check the conflicts of the corresponding packages

But none of them can solve the problem very well because this problem occurs because there is a problem with the versions of springboot and springcloud. So I looked for the corresponding relationship between springboot and springcloud. The official website address is as follows Spring Cloud

Once you have an idea, make some changes accordingly: the steps are as follows:

  1. Delete the dependency of spring-context

2.Introduce the following packages

<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>2021.0.5</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
<dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bootstrap</artifactId>
            <version>3.1.5</version>
        </dependency>

So far org.springframework.core.metrics.ApplicationStartup solved

  1. The error is reported again after restarting:

Caused by: java.lang.ClassNotFoundException: redis.clients.jedis.util.SafeEncoder

java.lang.NoClassDefFoundError: reactor/core/publisher/TopicProcessor

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.data.redis.repository.configuration.RedisRepositoryConfigurationExtension

Wait for error

It was found that java-core was not introduced and there was a conflict in the redis version.

So re-add the pom file configuration

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
            <version>2.6.15</version>
        </dependency>
<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>5.3.27</version>
        </dependency>

The problem is solved, but it still takes a long time for these two packages to be introduced using maven. You can wait a little longer.