错误提示: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行代码是去掉所有警告。