环境:idea+jdk1.8+gradle6.7
报错内容:
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [applicationContext.xml]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'excelUtils' for bean class [com.xxx.cbb.utils.office.ExcelUtils] conflicts with existing, non-compatible bean definition of same name and class [com.xxx.cbb.utils.excel.ExcelUtils]
Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'excelUtils' for bean class [com.xxx.cbb.utils.office.ExcelUtils] conflicts with existing, non-compatible bean definition of same name and class [com.xxx.cbb.utils.excel.ExcelUtils]
分析:第一反应是类名冲突了,但检查项目中并没有类名相同,因此猜测是存在缓存
解决方法:使用gradle的clean功能清除缓存后再build,即可解决

这篇博客主要记录了一次在idea+jdk1.8+gradle6.7环境下遇到的Spring BeanDefinitionStoreException错误。错误提示表明存在类名冲突,但实际上并未发现相同类名。经过分析,问题被归因于缓存导致的冲突。解决方案是通过gradle的clean任务清理缓存,然后重新构建项目,成功解决了问题。
1万+

被折叠的 条评论
为什么被折叠?



