idea中的ssm项目,修改了包名后,项目就启动不起来了?

org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [mvc-dispatcher.xml]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'fileController' for bean class [com.sw.controller.FileController] conflicts with existing, non-compatible bean definition of same name and class [com.cm.controller.FileController]
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:414)

报名从com.cm改成了com.sw
,所以并不存在`
com.cm.controller.FileController

阅读 4k
2 个回答

全局搜索一下之前的包名,漏改了吧

1、 bean 重复,删掉一个就好了。

com.sw.controller.FileController
com.cm.controller.FileController

2、或者加个别名

@RestController("xxxController")
@RequestMapping("common")
public class CommonController {

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题