记录一次未知错误:mybatis-plus的ServiceImpl实现类在某些条件下出现循环引用问题
触发条件:1.在BaseService(ServiceImpl实现类)同级目录下中添加子包并添加一些实现类2.添加shiro注解支持的配置此时BaseService同级目录下的类,被识别为算是被Spring认为是包装过的类关于Springboot+MybatisPlus架构循环依赖问题研究 - 法号钦尘的个人空间 - OSCHINA - 中文开源技术交流社区如出现循环引用会报错:but has e
·
触发条件:1.在BaseService(ServiceImpl实现类)同级目录下中添加子包并添加一些实现类

2.添加shiro注解支持的配置

此时BaseService同级目录下的类,被识别为算是被Spring认为是包装过的类关于Springboot+MybatisPlus架构循环依赖问题研究 - 法号钦尘的个人空间 - OSCHINA - 中文开源技术交流社区如出现循环引用会报错:
but has eventually been wrapped.
Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sysUserService': Bean with name 'sysUserService' has been injected into other beans [sysUserService] 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 'getBeanNamesForType' with the 'allowEagerInit' flag turned off, for example.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:623) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:657) ~[spring-beans-5.2.14.RELEASE.jar:5.2.14.RELEASE]
解决此问题目前知道的是在加@Autowired注解同时加 @Lazy注解
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐

所有评论(0)