Spring报错:has been injected into other beans [xxx] in its raw version as part of a circular reference

2020-01-05 12:48:03

参考链接 Spring报错:has been injected into other beans [xxx] in its raw version as part of a circular reference

一、问题描述


在启动项目时,遇到Spring报错,但不影响正常使用,经整理,报错信息如下:


org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'systemService': Bean with name 'systemService' has been injected into other beans [yeeDoctorsImpactService] 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.


 


二、项目简述


1、 SSM结构, Spring 全家桶4.3+ 。


2、使用 @Autowired 注解注入需要用到的 Service 。


 


三、问题解决


1、原因: systemService 类中注入了 yeeDoctorsImpactService , 而在 yeeDoctorsImpactService 类中也注入了 systemService ,从而引起该异常。 (循环引用)


2、解决: systemService 类注入 yeeDoctorsImpactService 时,增加注解 @Lazy ,反之同理。


3、@Lazy 注解路径为: org.springframework.context.annotation.Lazy 。


 

  • 2020-11-24 19:18:43

    nuxtjs打成用于webview的相对路径

    路径为绝对路径,当项目的域名为二级域名的时候,就不能打包为这绝对路径了。 nuxt不同于vue项目,思索了许久,终于找到了配置的地方

  • 2020-11-24 23:22:59

    eruda,移动端网页调试神器

    webapp或者移动端网页需要嵌入到app时候,尤其是在APP内置的webView上加载我们的页面,想要查看手机浏览器信息是非常困难的事,当出现问题的时候,你又不能查看日志,一般会连接本地测试环境,然后在alert来打印日志

  • 2020-11-30 09:04:02

    js中set和get方法

    1. get和set是方法,因为是方法,所以可以进行判断 2. get一般是要返回的;而set是设置,不用返回 3. 如果调用对象内部的属性约定的命名方式是变量名前加_

  • 2020-12-01 16:10:12

    IntelliJ IDEA之代理配置 anyproxy

    网络号,真是太爽了,真的,如果又了好的网络,开发真是事半功倍,所以,大家开发前,一定要把自己的网络给整好。 会给你节省不少时间呢。

  • 2020-12-01 16:14:54

    HTTP状态码429的含义

    发生429是服务器接口并发太多引起的,可根据代码进行修改,放开限制次数