环境: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,即可解决