"请问报这个错是什么原因,Annotation-specified bean name 'resourceServiceImpl' for bean class [cn.xgcode.forumapplication.temp.impl.ResourceServiceImpl] conflicts with existing, non-compatible bean definition of same name and class [cn.xgcode.forumapplication.service.file.impl.ResourceServiceImpl]"\n\n这个错误的原因是在Spring容器中存在两个相同名称但不兼容的bean定义。具体来说,一个是注解指定的bean名称为'resourceServiceImpl',类为'cn.xgcode.forumapplication.temp.impl.ResourceServiceImpl',另一个是同名但类为'cn.xgcode.forumapplication.service.file.impl.ResourceServiceImpl'的bean。\n\n可能的原因是在Spring配置文件或注解中重复定义了相同名称的bean,并且它们的类路径不同。解决这个问题的方法是修改其中一个bean的名称,以确保在Spring容器中唯一。\n\n例如,可以将其中一个bean的名称更改为'resourceServiceImplTemp'或'resourceServiceImplFile',以避免名称冲突。


原文地址: https://www.cveoy.top/t/topic/pDnJ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录