本文主要是介绍could not be registered. A bean with that name has already been defined in class path resource [com/,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
报错:
could not be registered. A bean with that name has already been defined in class path resource [com/ocean/conf/SwaggerConfig.class] and overriding is disabled
解决方案总结:
1.删除拦截器类级别的@Component注解
2.将配置类中的@Bean改为IOC自动注入
3.application配置文件里加一行:spring.main.allow-bean-definition-overriding: true 。当遇到同样名字的时候,是否允许覆盖注册
第三种方案我没试,有兴趣的可以尝试一下。
参考:
https://blog.csdn.net/qq_37663871/article/details/105577394
这篇关于could not be registered. A bean with that name has already been defined in class path resource [com/的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!