类无法注册

来源:16-2 升级到2.1.1

向往平凡却不甘于平凡

2019-06-04

升级到2.1.1后莫名
2019-06-04 10:20:27,017 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name ‘wxMpConfigStorage’ defined in class path resource [com/imooc/config/WechatOpenConfig.class]: Cannot register bean definition [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=wechatOpenConfig; factoryMethodName=wxMpConfigStorage; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/imooc/config/WechatOpenConfig.class]] for bean ‘wxMpConfigStorage’: There is already [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=wechatMpConfig; factoryMethodName=wxMpConfigStorage; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/imooc/config/WechatMpConfig.class]] bound.
2019-06-04 10:20:27,026 -

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.

The bean ‘wxMpConfigStorage’, defined in class path resource [com/imooc/config/WechatOpenConfig.class], could not be registered. A bean with that name has already been defined in class path resource [com/imooc/config/WechatMpConfig.class] and overriding is disabled.

微信开放平台的配置文件无法注册了

写回答

2回答

向往平凡却不甘于平凡

提问者

2019-06-04

2019-06-04 10:20:27,017 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name ‘wxMpConfigStorage’ defined in class path resource [com/imooc/config/WechatOpenConfig.class]: Cannot register bean definition [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=wechatOpenConfig; factoryMethodName=wxMpConfigStorage; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/imooc/config/WechatOpenConfig.class]] for bean ‘wxMpConfigStorage’: There is already [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=wechatMpConfig; factoryMethodName=wxMpConfigStorage; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/imooc/config/WechatMpConfig.class]] bound.
2019-06-04 10:20:27,026 -
Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
The bean ‘wxMpConfigStorage’, defined in class path resource [com/imooc/config/WechatOpenConfig.class], could not be registered. A bean with that name has already been defined in class path resource [com/imooc/config/WechatMpConfig.class] and overriding is disabled.

微信开放平台WechatMpConfig这个配置文件无法注册,没升级前 项目可以跑起来的,

0
2
廖师兄
只改了boot的版本吗?课程最后我升级了boot版本,你运行我的源码试试
2019-06-04
共2条回复

廖师兄

2019-06-04

日志格式化一下,否则没法看。你检查是不是忘记加@Bean了,对比我的源码

0
0

Spring Boot双版本(1.5/2.1) 打造企业级微信点餐系统

从0到1开发中小型企业级Java应用,并学会迭代重构技巧

6410 学习 · 5247 问题

查看课程