搭建ssm框架遇到的错误:
错误信息:
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'studentController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.xiaobao.ssm.controller.StudentController.setService(com.xiaobao.ssm.service.StudentServiceImpl); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.xiaobao.ssm.service.StudentServiceImpl] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
错误根源:spring-mvc.xml配置出错
更改前的注解扫描 <context:component-scan base-package="com.ths.web.controller" />
更改后的注解扫描<context:component-scan base-package="com.ths.web" />