解决办法: 执行Maven中Lifecycle的clean命令。
相关异常: 将原package名称“controller”重命名为“app”,重新启动服务,启动失败。控制台打印出的部分异常信息如下:
2021-02-15 17:52:23.937 WARN 19900 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.xxx.xxxx.test.XxxApplication]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'xxXController' for bean class [com.xxx.xxxx.test.controller.AxxxxController] conflicts with existing, non-compatible bean definition of same name and class [com.xxx.xxxx.test.app.AxxxxController]
2021-02-15 17:52:23.956 ERROR 19900 --- [ main] o.s.boot.SpringApplication : Application run failed
本文讲述了如何在Spring Boot应用中解决因package重命名导致的Controller类冲突问题,通过执行Maven clean命令并调整包结构来修复。核心内容涉及BeanDefinitionStoreException和ConflictingBeanDefinitionException异常及其处理方法。
1728

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



