java.lang.NoSuchMethodError:org.springframework.boot.builder.SpringApplicationBuilder。<init>([Ljava / lang / Object;)V

时间:2019-08-09 08:50:19

标签: java spring-boot spring-cloud-dataflow

我正在编写一个简单的应用程序以熟悉Spring Batch。我想学习spring batch admin,但是我发现它已被弃用,因此我必须改用spring cloud数据流。

我找到了有关春季云数据的教程,并做了第一步:

  1. 添加的依赖项:

    compile(“ org.springframework.cloud:spring-cloud-starter-dataflow-server-local:1.7.4.RELEASE”)

  2. 并用additioanl注释标记了我的spring boot应用程序类:

    @EnableDataFlowServer

现在我正在尝试使用idea运行它,但它会打印:

10:24:09.590 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Object;)V
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:161)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:102)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:68)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:75)
    at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:53)
    at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:340)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:304)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1213)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1202)
    at spring.boot.hello.world.MyApplication.main(MyApplication.java:11)

1 个答案:

答案 0 :(得分:0)

在大多数情况下,这是由于缺少依赖关系,或者是由于较早的spring / spring引导版本附带了依赖关系。 检查您的maven依赖树,并搜索比您的父级初学者所请求的版本更早的spring-boot依赖项。 org.springframework.cloud:spring-cloud-starter-dataflow-server-local:1.7.4.RELEASE可能是较旧的版本,您需要排除它。