IDEA报错ain] o.s.b.d.LoggingFailureAnalysisReporter

本文主要介绍了在IntelliJ IDEA中遇到的错误:尝试调用不存在的方法,涉及Spring Boot的配置类Bean定义。解决方案包括在@SpringBootApplication中排除DataSourceAutoConfiguration,以及检查并处理可能的包冲突。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

IDEA报错ain] o.s.b.d.LoggingFailureAnalysisReporter :

详细描述

An attempt was made to call a method that does not exist. The attempt was made from the following location:

org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.isOverriddenByExistingDefinition(ConfigurationClassBeanDefinitionReader.java:304)

The following method did not exist:

org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader$ConfigurationClassBeanDefinition.setNonUniqueFactoryMethodName(Ljava/lang/String;)V

The method’s class, org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader$ConfigurationClassBeanDefinition, is available from the following locations:

jar:file:/C:/Users/CHENZHIWEI/.m2/repository/org/springframework/spring-context/5.2.9.RELEASE/spring-context-5.2.9.RELEASE.jar!/org/springframework/context/annotation/ConfigurationClassBeanDefinitionReader$ConfigurationClassBeanDefinition.class

The class hierarchy was loaded from the following locations:

org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.ConfigurationClassBeanDefinition: file:/C:/Users/CHENZHIWEI/.m2/repository/org/springframework/spring-context/5.2.9.RELEASE/spring-context-5.2.9.RELEASE.jar
org.springframework.beans.factory.support.RootBeanDefinition: file:/C:/Users/CHENZHIWEI/.m2/repository/org/springframework/spring-beans/5.1.3.RELEASE/spring-beans-5.1.3.RELEASE.jar
org.springframework.beans.factory.support.AbstractBeanDefinition: file:/C:/Users/CHENZHIWEI/.m2/repository/org/springframework/spring-beans/5.1.3.RELEASE/spring-beans-5.1.3.RELEASE.jar
org.springframework.beans.BeanMetadataAttributeAccessor: file:/C:/Users/CHENZHIWEI/.m2/repository/org/springframework/spring-beans/5.1.3.RELEASE/spring-beans-5.1.3.RELEASE.jar
org.springframework.core.AttributeAccessorSupport: file:/C:/Users/CHENZHIWEI/.m2/repository/org/springframework/spring-core/5.2.9.RELEASE/spring-core-5.2.9.RELEASE.jar

Action:

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader$ConfigurationClassBeanDefinition

Process finished with exit code 1

解决办法

在Application中将@SpringBootApplication修改成:
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class)

若不行则
检查pom.xml
若添加了

<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-beans</artifactId>
			<version>5.1.3.RELEASE</version>
</dependency>

则为包冲突,将其删除即可
因为在创建Spring boot 工程的时候已经默认导入了最新的jar

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值