Spring MVC 注入autowired的依赖关系失败
2018-02-27 14:14
330 查看
错误提示:Error creating bean with name 'mainController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.ths.home.web.main.service.IMainService com.ths.home.web.main.shtml.MainController.iservice; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.ths.home.web.main.service.IMainService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
说的是:注入autowired的依赖关系失败,嵌套的异常。
错误在 26,27 行,因为下面的代码没有加上注解。
当加上 13行的代码就没错了,14行代码是去掉所有警告。
说的是:注入autowired的依赖关系失败,嵌套的异常。
错误在 26,27 行,因为下面的代码没有加上注解。
当加上 13行的代码就没错了,14行代码是去掉所有警告。
相关文章推荐
- Spring MVC Tomcat启动异常 @Autowired注入失败
- 因Spring AOP导致@Autowired依赖注入失败的解决方法
- (项目)报错:Injection of autowired dependencies failed;依赖注入失败
- SpringAOP导致@Autowired依赖注入失败
- Spring MVC 启动异常,@Autowired注入失败。
- spring下应用@Resource, @Autowired 和 @Inject注解进行依赖注入的差异
- Spring源码分析--@Autowired注入的不是代理对象,导致事务回滚失败(@Transactional无效)
- 初识SpringBoot @Autowired注入失败
- spring 中@Autowired注入失败问题
- spring 在Thread中注入@Resource@Autowired失败,总为null~解决
- SpringBoot集成Quartz(解决@Autowired空指针Null问题即依赖注入的属性为null)
- Spring对于Bean的依赖注入:@Autowired @Inject @Resource
- 反射调用service层,@Autowired注入失败的解决方案
- spring @Autowired注入失败
- 使用反射机制调用service层方法Autowired标签自动注入失败
- spring下应用@Resource, @Autowired 和 @Inject注解进行依赖注入的差异
- Spring Bean依赖但注入(autowired或resource)时NullPointerException(xml和annotation混用的场景下)
- spring boot项目依赖spring mvc项目注入失败问题
- Spring MVC中使用@Autowired实现自动注入
- springMVC项目启动时出现bean注入失败的情况:Error creating bean with name 'XXX': Injection of autowired dependencies