添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
解决异常:org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name
最新推荐文章于 2024-01-30 19:11:37 发布
最新推荐文章于 2024-01-30 19:11:37 发布 阅读量 10w+

报错信息:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘ receiverController ’: Unsatisfied dependency expressed through field ‘service’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.teemlink.sync.service.SyncService’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:586)

在这里插入图片描述
从报错信息可以知道,在注入 receiverController 这个bean时发生错误,而发生这种错误的原因有以下几种:
1、检查receiverController这个类有没有添加@Controller注解

2、检查receiverController类调用的service类有没有添加@Service注解

3、检查receiverController类下的Dao层或Mapper层类上有没有添加注解

4、检查启动类上包扫描有没有扫描到receiverController类
在这里插入图片描述
我这次的情况是启动类上没有添加receiverController类的包扫描,而以前报这个错误是因为忘记添加注解,所以报了该异常

欢迎大家阅读,本人见识有限,写的博客难免有错误或者疏忽的地方,还望各位大佬指点,在此表示感谢。觉得本文章有帮助到的,点个赞呗

org . springframework . beans . factory . UnsatisfiedDependency Exception Spring 框架中的一个 异常 ,它通常表示在依赖注入过程中出现了问题,无法满足依赖关系。 org . springframework . beans . factory . UnsatisfiedDependency Exception : Error crea ting bea n with name; UnsatisfiedDependency Exception org . springframework . beans . factory . UnsatisfiedDependency Exception : Error crea ting bea n with name 'com.example. Spring Boot JdbcDemoApplication. Spring Boot JdbcDemoApplication': Unsatisfied dependency expres 在 解决 UnsatisfiedDependency Exception 异常 之前,我们首先需要检查 bea n的定义和注入是否正确。可能的问题包括拼写错误、类型不匹配等。检查 bea n的定义,确保没有拼写错误。检查 bea n的注入,确保注入的类型与依赖的类型匹配。使用@Autowired或@Resource注解进行注入,以确保自动装配的正确性。// ... } 解决 Spring UnsatisfiedDependency Exception 异常 是开发过程中常见的任务。 记录报错及 解决 error crea ting bea n with name ‘ ‘,unsatisfied dependency 本来运行好好的一个项目,昨天打开还好好的,今天一打开就报错了,真是活见鬼了 = = 然后今天在网上查了很久有关这个的报错消息: 检查service的实现类serviceImpl,mapper上是否加了@XXX注解,是否implement了service等注解引入的问题 检查类名和mapper扫描路径是否写错 涉及maven仓库底层的文件的配置错误,这边尤其是pom文件的引入,就 警告: Exception encountered during context initialization - cancelling refresh attempt: org . springframework . beans . factory . UnsatisfiedDependency Exception : Error crea ting bea n with name 'userDaoImpl': Unsatisfied dependency expressed through field 'jdbcTemplat org . springframework . beans . factory . UnsatisfiedDependency Exception : Error crea ting bea n with name 'userController': Unsatisfied dependency expressed through field 'userMapper'; nested exception is org . springframework . beans . factory . UnsatisfiedDependency Except 完整报错如下:太长,把我认为重要信息用下划线标重点。 WARN 7612 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org . springframework . beans . factory . UnsatisfiedDependency Exception : Error ... org . springframework . beans . factory . UnsatisfiedDependency Exception :报错 解决 可以理解为依赖失败吧,找不到依赖 部分报错如下: org . springframework . beans . factory . UnsatisfiedDependency Exception : Error crea ting bea n with name 'pageService': Unsatisfied dependency expressed through field 'p 先看一眼报错,一直把错误放在了前一句无法创建 bea n,以为是版本冲突或者依赖没导入,结果是因为最后一个报错说了未连接到redis,打开redis一看,原来是服务挂掉了。。。。真无语 org . springframework . beans . factory . UnsatisfiedDependency Exception : Error crea ting bea n with name 'redisTemplate' defined in class path resource [ org /redisson/ spring spring boot 中遇到了 UnsatisfiedDependency Exception : Error crea ting bea n with name 'XXXController'的问题,代码如下 //controller public class XXXController{ @Autowired private XXXService xxxService; ..... 这个 异常 在网上找了好多办法,什么防火墙啊之类的,最后发现是启动顺序问题,先启动服务提供者,再启动消费者就好了,不然找不到服务就会报这个错误 org . springframework . beans . factory . UnsatisfiedDependency Exception : Error crea ting bea n with name 'managerItemCatServiceImpl': Unsat... org . springframework . beans . factory . UnsatisfiedDependency Exception : Error crea ting bea n with name ‘brandController’: Unsatisfied dependency expressed through field ‘brandService’; nested exception is or... 启动项目时产生报错: org . springframework . beans . factory . UnsatisfiedDependency Exception : Error crea ting bea n with name 'shiroFilter' defined in class path resource [com/cdzn/mhs/config/ShiroConfig.class]: Unsatisfied dependency expressed through method 'shiroFilter' p