`

Spring类同名引起的ConflictingBeanDefinitionException异常

阅读更多

使用@Component、@Repository、@Service、@Controller标签会自动将类注册到spring容器中。在没有指定bean名称的时候getBean的默认名称是类名(头字母小写)这样类名相同的时候就会造成bean实例的id相同所以在出现相同类名时候会出现ConflictingBeanDefinitionException异常

报错信息:

Annotation-specified bean name '**********' for bean class [com.**********] conflicts with existing, non-compatible bean definition of same name and class [com.**********]

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics