gpt4 book ai didi

java - 1.3.7.发布 -> 1.4.1.发布 | java.lang.NoSuchMethodError : org. springframework.boot.builder.SpringApplicationBuilder.showBanner 错误

转载 作者:塔克拉玛干 更新时间:2023-11-03 03:41:30 25 4
gpt4 key购买 nike

如果我切换到新版本的SpringBoot,我在启动应用程序时会得到上面的错误信息。这是为什么?

最美好的祝愿史蒂文

pom.xml

<?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>de.xyz.microservice</groupId>
<artifactId>spring-boot-test</artifactId>
<version>1.0-SNAPSHOT</version>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<!--version>1.3.7.RELEASE</version-->
<version>1.4.1.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>

</project>

堆栈跟踪:

Exception in thread "main" java.lang.NoSuchMethodError:
org.springframework.boot.builder.SpringApplicationBuilder.showBanner(Z)Lorg/springframework/boot/builder/SpringApplicationBuilder;
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:109)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:75)...

主类:

@SpringBootApplication
@ComponentScan(value = "de.xyzs.microservice")
@EnableAspectJAutoProxy(proxyTargetClass = true)

public class MainClass {

public static void main(String[] args) {
SpringApplication.run(MainClass.class, args);
}
}

最佳答案

我能够通过显式声明适用于版本 1.4.4 的云上下文依赖关系来解决此问题

    <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-context</artifactId>
<version>1.1.8.RELEASE</version>
</dependency>

关于java - 1.3.7.发布 -> 1.4.1.发布 | java.lang.NoSuchMethodError : org. springframework.boot.builder.SpringApplicationBuilder.showBanner 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40258498/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com