spring service层 循环引用问题。
来源:互联网 发布:免费群发短信软件 编辑:程序博客网 时间:2024/06/06 15:40
报错信息如下:
Error creating bean with name 'smsCodeApiController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.zhenler.microcode.service.IWechatUserService com.zhenler.commonality.controller.api.SmsCodeApiController.wechatUserService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wechatUserServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.zhenler.eorder.food.service.IFoodService com.zhenler.microcode.service.impl.WechatUserServiceImpl.iFoodService; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'foodServiceImpl': Bean with name 'foodServiceImpl' has been injected into other beans [foodPackageServiceImpl] in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.
如出现上诉情况, 避免报错 可以在service中添加:@Lazy(true) 例如:
@Autowired@Lazy(true)private IFoodPackageService foodPackageService;
则可以解决 循环引用 导致tomcat启动报错问题。 此为解决方案的一种 但是根本问题并没有得到解决。 尽量在涉及架构的时候 进行松耦合
阅读全文
1 0
- spring service层 循环引用问题。
- spring循环引用的问题
- spring bean循环引用问题
- spring service层配置
- spring循环引用
- spring循环引用
- spring bean循环引用
- spring循环引用
- spring quartzy的spring注入问题(dao层和service层)
- Spring循环引用和AOP代理引发的两个问题
- Spring boot单元测试-service层
- spring一站式框架(service层)
- Spring集成Hibernate5_04-Service层
- spring aop同时代理service层和controller层的问题
- 循环引用问题,
- 循环引用问题
- block循环引用问题
- blocks 循环引用问题
- android-布局优化:merge+include
- Vim 命令集合
- Python采用raw_input读取输入值的方法
- 金蝶BOS,String、BOSUuid、IObjectPK之间相互转换
- Android 快速开发模版,我的第一个开源项目
- spring service层 循环引用问题。
- WEB服务器、应用程序服务器、HTTP服务器区别
- mysql 创建用户分配权限命令
- 编程第七十六、七十七天
- PHP设置默认时区
- better call saulS03E08
- 常用的网络相关命令
- JS中onclick事件的一个坑
- Mysql-Connector-ODBC 安装报错126,解决办法