解决 The bean ‘xxx’, defined in class path resource [], could not be registered. A bean with that name has already been defined in file []and overriding is disabled.

如果你不相信努力和时光,那么成果就会是第一个选择辜负你的。不要去否定你自己的过去,也不要用你的过去牵扯你现在的努力和对未来的展望。不是因为拥有希望你才去努力,而是去努力了,你才有可能看到希望的光芒。解决 The bean ‘xxx’, defined in class path resource [], could not be registered. A bean with that name has already been defined in file []and overriding is disabled.,希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com,来源:原文

问题:

在实现短信发送拦截功能时,创建了 PassportInterceptor 验证码拦截器类,使用了@Conponent注解;

同时创建了 InterceptorConfig 拦截器配置类,使用了@Conponent注解,并使用@Bean注解创建了 PassportInterceptor 构造器。代码如下:

解决 The bean 'xxx', defined in class path resource [], could not be registered. A bean with that name has already been defined in file []and overriding is disabled.

解决 The bean 'xxx', defined in class path resource [], could not be registered. A bean with that name has already been defined in file []and overriding is disabled.

启动后报错:

解决 The bean 'xxx', defined in class path resource [], could not be registered. A bean with that name has already been defined in file []and overriding is disabled.

解决:

在 application.yml 配置中启用 beans 覆盖机制 

spring.main.allow-bean-definition-overriding=true

解决 The bean 'xxx', defined in class path resource [], could not be registered. A bean with that name has already been defined in file []and overriding is disabled.

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/195218.html

(0)
小半的头像小半

相关推荐

极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!