springboot与springcloud版本不对应导致报错java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.([Ljava/lang/Object;)V

时间:2023-03-09 21:39:41
springboot与springcloud版本不对应导致报错java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Object;)V

springboot启动报错:

10:31:50.221 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Object;)V

原因:

springboot与springcloud版本不对应。

举例:springboot版本<version>2.1.0.RELEASE</version> 需要与springcloud版本<version>Greenwich.SR2</version>有对应关系。

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Greenwich.SR2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

其它版本:

大版本对应:

Spring Boot Spring Cloud
1.2.x Angel版本
1.3.x Brixton版本
1.4.x stripes Camden版本
1.5.x Dalston版本、Edgware版本
2.0.x Finchley版本
2.1.x Greenwich.SR2

在实际开发过程中,我们需要更详细的版本对应  (https://start.spring.io/actuator/info)

spring-boot-starter-parent spring-cloud-dependencies
版本号 发布日期   版本号 发布日期  
1.5.2.RELEASE 2017年3月 稳定版 Dalston.RC1 2017年未知月  
1.5.9.RELEASE 2017年11月 稳定版 Edgware.RELEASE 2017年11月 稳定版
1.5.16.RELEASE     Edgware.SR5    
1.5.20.RELEASE     Edgware.SR5    
Spring Boot >=2.0.0.M3 and <2.0.0.M5     Finchley.M2    
Spring Boot >=2.0.0.M5 and <=2.0.0.M5     Finchley.M3    
Spring Boot >=2.0.0.M6 and <=2.0.0.M6     Finchley.M4    
Spring Boot >=2.0.0.M7 and <=2.0.0.M7     Finchley.M5    
Spring Boot >=2.0.0.RC1 and <=2.0.0.RC1     Finchley.M6    
Spring Boot >=2.0.0.RC2 and <=2.0.0.RC2     Finchley.M7    
Spring Boot >=2.0.0.RELEASE and <=2.0.0.RELEASE     Finchley.M9    
 Spring Boot >=2.0.1.RELEASE and <2.0.2.RELEASE      Finchley.RC1    
Spring Boot >=2.0.2.RELEASE and <2.0.3.RELEASE     Finchley.RC2    
Spring Boot >=2.0.3.RELEASE and <2.0.999.BUILD-SNAPSHOT     Finchley.SR4    
Spring Boot >=2.0.999.BUILD-SNAPSHOT and <2.1.0.M3     Finchley.BUILD-SNAPSHOT    
Spring Boot >=2.1.0.M3 and <2.1.0.RELEASE     Greenwich.M1    
Spring Boot >=2.1.0.RELEASE and <2.1.9.BUILD-SNAPSHOT     Greenwich.SR2    
Spring Boot >=2.1.9.BUILD-SNAPSHOT and <2.2.0.M4     Greenwich.BUILD-SNAPSHOT    
Spring Boot >=2.2.0.M4 and <=2.2.0.M5     Hoxton.M2    
Spring Boot >=2.2.0.BUILD-SNAPSHOT     Hoxton.BUILD-SNAPSHOT    
 待更新...          

参考博客:https://www.cnblogs.com/zhuwenjoyce/p/10261079.html