SpringBoot项目启动报错:Injection of resource dependencies failed; nested exception is org.springframework

这篇具有很好参考价值的文章主要介绍了SpringBoot项目启动报错:Injection of resource dependencies failed; nested exception is org.springframework。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

bean注入失败,报错如下:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AAAImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'BBBImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'FFFImpl': Unsatisfied dependency expressed through field 'nnService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxxService': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [XXXService] from ClassLoader [sun.misc.Launcher$AppClassLoader@58644d46]
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:332)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
	at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$246/2091160281.getObject(Unknown Source)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:544)
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:520)
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:673)
	at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:228)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:329)
	... 87 more
  1. 检查最后一行报错的XXXService,里面注入的service类,是否互相注入
  2. 检查注入的对象名是否为类名一致(首字母小写)
    只使用@Autowired时,需要保证注解的对象名和注解类名一致,
    注意: 首字母要小写,且注解时没有命名

解决:
方法1:优化代码,去掉互相注入的情况
方法2:使用注解,@Lazy(true)文章来源地址https://www.toymoban.com/news/detail-853308.html

到了这里,关于SpringBoot项目启动报错:Injection of resource dependencies failed; nested exception is org.springframework的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Injection of autowired dependencies failed; nested exception is java.lang.Il

    ​ 今天在学习nacos统一配置管理时,使用了@value注解,用来注入nacos中的配置属性,发现读取不到,代码如下: 启动服务时发现报以下错误: 经过多方面检查,发现是环境问题,我bootstrap.yml中写给我的统一配置管理配置的是dev开发环境,配置如下: 而我的服务没有配置为开发环

    2024年02月07日
    浏览(34)
  • SpringBoot启动项目报错: Consider defining a bean of type ‘xxx‘ in your configuration.

    原因:涉及这类bean问题的报错,大多数导致原因为对应的bean类或bean名未注入容器 检查思路或解决办法: 1.根据提示信息里的bean名称和找不到的类名,检查该类是否具有把该类以报错bean名注入容器的操作,如没有添加注解或者xml文件注入容器,然后再去启动检查是否可以启

    2024年04月10日
    浏览(32)
  • Spring6-IoC(Inversion of Control)控制反转和DI(Dependency Injection)依赖注入,手动实现IOC

    Java 反射机制是在运行状态中,对于任意一个类,都能够知道这个类的所有属性和方法;对于任意一个对象,都能够调用它的任意方法和属性;这种动态获取信息以及动态调用对象方法的功能称为 Java 语言的 反射机制 。简单来说, 反射机制指的是程序在运行时能够获取自身

    2024年02月09日
    浏览(53)
  • SpringBoot中循环依赖报错解决---The dependencies of some of the beans in the application context form a cycle

    循环依赖: 循环依赖就是循环引用,也就是两个或则两个以上的bean互相依赖对方,形成闭环。比如A类中有B属性,B类中有A属性 一、报错信息 The dependencies of some of the beans in the application context form a cycle:  二、解决方案 1、修改配置文件 根据Action中的提示 不鼓励依赖循环引用

    2024年02月11日
    浏览(93)
  • 解决Springboot项目打成jar包后获取resources目录下的文件报错的问题

    前几天在项目读取resources目录下的文件时碰到一个小坑,明明在本地是可以正常运行的,但是一发到测试环境就报错了,说找不到文件,报错信息是:class path resource [xxxx] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:xxxx.jar!/BOOT-INF/classes!xxxx。 看了

    2024年02月11日
    浏览(46)
  • IDEA项目启动报错:Failed to execute goal on project xxx: Could not resolve dependencies for project

    [ERROR] Failed to execute goal on project xxx: Could not resolve dependencies for project Failed to collect dependencies at xxx .xxx-service:jar:dev: Failed to read artifact descriptor for xxxx/maven-snapshots/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of nexus-snaps

    2024年02月03日
    浏览(56)
  • vue 启动项目报错Cannot read properties of undefined (reading ‘parseComponent‘)

    如果出现如下报错大概率是因为install时中途出现异常导致vue-template-compiler依赖没有正常安装导致的,重新安装即可 1、 yarn add vue-template-compiler 或 npm add vue-template-compiler 2、最后如果还是不行就再用 yarn upgrade –latest vue-template-compiler npm upgrade –latest vue-template-compiler

    2024年02月12日
    浏览(35)
  • vue 启动项目报错:TypeError: Cannot set property ‘parent‘ of undefined异常解决

    场景:从git上面拉下来一个项目 npm i 下载完依赖以后 npm run serve 去运行项目的时候 报错TypeError: Cannot set property ‘parent’ of undefined 如图所示 原因:首先排查发现判断得出是less解析失败导致 但是经过长时间的查询解决方案发现是因为vue版本在下载包的过程中由2.6.10升级为2

    2024年02月12日
    浏览(39)
  • 什么是依赖注入(Dependency Injection)?

    依赖注入(Dependency Injection,简称DI)是一种设计模式,用于实现类之间的解耦和依赖关系的管理。它通过将依赖关系的创建和维护责任转移到外部容器中,使得类不需要自己实例化依赖对象,而是由外部容器动态地注入依赖。 传统的对象创建方式往往由类自身负责创建和管

    2024年02月15日
    浏览(24)
  • Understanding Dependency Injection for angular

    Angular https://angular.io/guide/dependency-injection Denpendency Injection,  or DI, is one of fundamental concepts for angular, DI is writed by angular framework and allows classes with  Angular decorators,  such as Components, directives, Piples and Injectables , to configure dependencies that they need.  Two main roles exists in DI system: dependency

    2024年02月10日
    浏览(21)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包