You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Spring Boot 1.4.2.RELEASE适配Spring Cloud版本咨询及报错解决

Fixing the NoSuchMethodError from Spring Boot & Spring Cloud Version Mismatch

Hey, I see exactly what's going on here—you're hitting a classic version compatibility issue between Spring Boot and Spring Cloud. Let's break this down and get it sorted.

The Root Cause

Your project is using Spring Boot 1.4.2.RELEASE with Spring Cloud Finchley.SR1, and these two versions don't play nice together. Finchley is built specifically for Spring Boot 2.0.x, so when it tries to call a constructor for SpringApplicationBuilder that doesn't exist in the older 1.4.x Boot, you get that NoSuchMethodError.

Compatible Spring Cloud Version for Your Setup

For Spring Boot 1.4.2.RELEASE, you need to use the Spring Cloud Camden release train. The most stable, final version in this train is Camden.SR7—that's the one you should switch to.

Full Error Stack Trace

Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Class;)V
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:170)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:104)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:70)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:121)
    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:68)
    at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
    at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:337)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175)
    at com.sarathi5.Sarathi5TestCase2Application.main(Sarathi5TestCase2Application.java:14)

Updated pom.xml Configuration

I've adjusted your pom to use the correct Cloud version, and also added a property for the Spring Cloud version to make future maintenance easier:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>TestCase2</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>TestCase2</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.2.RELEASE</version>
        <relativePath/><!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
        <drools.version>6.2.0.Final</drools.version>
        <spring-cloud.version>Camden.SR7</spring-cloud.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

</project>

Quick Note on Version Compatibility

Just to keep this in mind for future projects, Spring Cloud release trains are tightly coupled to specific Spring Boot versions:

  • Camden → Spring Boot 1.4.x
  • Dalston/Edgware → Spring Boot 1.5.x
  • Finchley → Spring Boot 2.0.x
  • Greenwich → Spring Boot 2.1.x
  • Hoxton → Spring Boot 2.2.x/2.3.x

After updating the pom, run mvn clean install to clear old dependencies and pull in the correct ones. That should resolve the error!

内容的提问来源于stack exchange,提问作者veer

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 09:18:48