请教 SpringMVC 中 @Autowired 注入报错?

信息: Initializing Spring FrameworkServlet 'spring-mvc'
17:00:57,884 ERROR DispatcherServlet:457 - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.sp.service.impl.UserServiceImpl com.sp.web.UserController.userService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.sp.service.impl.UserServiceImpl] 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)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)

[code="java"]expected at least 1 bean which qualifies as autowire candidate for this dependency. [/code]

提示的错误信息已经告诉你了。项目找不到你要自动注入的UserService.你看看你的扫描配置,对于需要扫描的package对了,应该是您的UserService所在的package不在扫面范围的package.