SSM框架,使用getBean可以成功获取,但是使用AutoWired注解出现错误

错误如下:

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'userService';
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type 'com.boron.service.UserService' available: expected at least 1 bean which qualifies as autowire candidate.
Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

原因如下:

    

   
    org.springframework.web.context.ContextLoaderListener
 

你可能感兴趣的:(java)