您的位置:首页 > 编程语言 > Java开发

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行代码是去掉所有警告。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: