preface

I have been using the SpringCloud version Hoxton.SR4 and the SpringBoot 2.2.5. Release version since the SpringCloud upgrade to 2020.0 and would like to try it out

Version control

Website has aContrast versions of SpringCloud and SpringBoot, which is the version I updated.





The following is byJSON to show SpringCloud version comparison



The following isNACOS corresponds to SpringCloud and SpringBoot versions of the comparison table:

Therefore, the SpringCloud version I choose is 2020.0.0, the SpringBoot version is 2.4.2, and the Alibaba version is 2021.1. Now let’s upgrade.

To upgrade

Introduce related dependency packages

<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> < version > < / version 2.4.2 > < / parent > < properties > < Java version > 1.8 < / Java version > < spring - the boot version > < 2.4.2 / spring - the boot. Version > < spring - cloud. Version > 2020.0.0 < / spring - cloud. Version > < spring - cloud - alibaba. Version > 2021.1 < / spring - cloud - alibaba. Version > < / properties > < dependencyManagement > < dependencies > <! Springframework. boot</ grouppid > -- Spring boot -- dependency> < grouppid >org.springframework.boot</ grouppid > <artifactId>spring-boot-dependencies</artifactId> <version>${spring-boot.version}</version> <type>pom</type> <scope>import</scope> </dependency> <! - spring cloud depend on - > < the dependency > < groupId > org. Springframework. Cloud < / groupId > <artifactId>spring-cloud-dependencies</artifactId> <version>${spring-cloud.version}</version> <type>pom</type> <scope>import</scope> </dependency> <! Cloud </ grouppid > -- Dependency > <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-alibaba-dependencies</artifactId> <version>${spring-cloud-alibaba.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency>  <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-oauth2</artifactId> < version > 2.2.5. RELEASE < / version > < / dependency > < the dependency > < groupId > org. Springframework. Cloud < / groupId > < artifactId > spring -- cloud ws-security < / artifactId > < version > 2.2.5. RELEASE < / version > < / dependency > < the dependency > <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-openfeign</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-loadbalancer</artifactId> </dependency> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> </dependency> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> </dependency> <! -- add to the bootstrap. Yml support - > < the dependency > < groupId > org. Springframework. Cloud < / groupId > <artifactId>spring-cloud-starter-bootstrap</artifactId> </dependency> </dependencies>

Problems encountered during the upgrade

  • Cloud2020.0.0 / cloud2020.0.0 / cloud2020.0.0 / cloud2020.0.0 / cloud2020.0.0 / cloud2020.0.0 / cloud2020.0.0 / cloud2020.0.0 / cloud2020.0.0 / cloud2020.0.0 / cloud2020.0.0 / cloud2020.0.0 / cloud2020.0.0 / cloud2020.0.0
  • 2. POM introduces the spring-cloud-starter-bootstrap package, otherwise bootstrap.yml will not work.
  • 3. Nacos Discovery must add Service attribute or report an error, as shown below:
spring:
  application:
    name: aaa
  profiles:
    active: test
  cloud:
    nacos:
      discovery:
        server-addr: http://nacos-host:8848
        namespace: xxx-xxx-xxx
        service: aaa
      config:
        server-addr: http://nacos-host:8848
        file-extension: yaml
        prefix: aaa
        namespace: xxx-xxx-xxx
server:
  port: 8901

conclusion

  • 1. The previous version of Spring-Cloud — Starter-OAuth2 package is gone, and the corresponding package is not found. The reference packages spring-security-oauth2 and spring-security-oauth2-autoconfigure can also implement OAuth2 Server functionality, but the associated classes are out of date.
  • 2. In previous versions, when Spring Cloud Bus was used with MQ, it was not possible to use Stream3.0 writing to receive messages. This issue has now been resolved.
  • With the exception of Eureka, all Netflix components have been removed

reference

SpringCloud upgrade to the 2020 record error dependencies. Dependency. Version is missing Spring Cloud Alibaba upgrade to 2.1.0 encountered pit nacos release notes SpringCloud version comparison