spring-boot - AbstractMethodError org.springframework.boot.context.config.ConfigFileApplicationListener.supportsSourceType with Spring boot 2.2.1
问题描述
我正在尝试使用 Spring Boot Starter 2.2.1、Spring Cloud 版本 Hoxton 和 Cloud Stream 版本 3.0.0 设置一个 Spring Cloud Stream 项目。
下面是我的 pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.1.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<spring-cloud.version>Hoxton.RELEASE</spring-cloud.version>
<java.version>1.8</java.version>
<kotlin.version>1.3.61</kotlin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</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>
当我运行应用程序时,我看到
java.lang.AbstractMethodError: org.springframework.boot.context.config.ConfigFileApplicationListener.supportsSourceType(Ljava/lang/Class;)Z at org.springframework.context.event.GenericApplicationListenerAdapter.supportsSourceType(GenericApplicationListenerAdapter.java:81)
...
我发现从 spring boot 2.0.5 迁移到 2.1.1 并且由于依赖项不匹配会引发相同的错误。
就我而言,我相信我使用的是正确的 Spring boot 和Spring Cloud发布版本,这pom.xml
是由 spring initializr 生成的。
但是,我尝试将 spring-core 升级到 5.2.1.release,因为默认的 spring-core(版本 5.0.5)抛出了这个错误 =>Caused by: java.lang.ClassNotFoundException: org.springframework.util.unit.DataSize
并且这个类是在 5.2.1 中引入的。
有人在 Spring boot 2.2.1 中遇到过这个错误吗?任何输入都受到高度赞赏。谢谢。
解决方案
推荐阅读
- python - 按下按钮时,如何使按钮将其名称传递给函数?
- excel - 从 Excel 工作表转换单元格链接时出现问题
- java - Thymeleaf 中的绑定列表;索引超出范围
- python - 线性回归分类器和线性回归提取机密区间有什么区别?
- git - 丢弃本地提交历史并将其替换为原点的提交历史
- c# - 项目“Projr”不是最新的。在 VS 2017 管理员模式下缺少输出文件 'c:\..\bin\Debug\Projr.dll'
- oracle - OraclePropertyGraphDataLoader 从 HDFS 加载数据
- ruby - Ruby 2.6.1 的 Docker 映像
- c++ - 用于格式转换/简单转换的 FFMpeg 与 OpenCV
- sql - 摆脱重复记录和计算字段