SpringMvc常见异常之org.springframework.beans.factory.NoSuchBeanDefinitionException

异常详细信息通常为:
No qualifying bean of type [com.bcws.service.UserService] found for dependency [com.bcws.service.UserService]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
出现这种异常的可能性有以下几种:
1.没有添加自动扫描

 
      
 
     
2.服务器启动时加载配置文件有误(web.xml)

	contextConfigLocation
	classpath:spring-mybatis.xml

	SpringMVC
	org.springframework.web.servlet.DispatcherServlet
	
		contextConfigLocation
		classpath:spring-mvc.xml
	
	1
	true
3.没有配置Spring监听器(web.xml)

	org.springframework.web.context.ContextLoaderListener

4.配置文件中路径错误,比如:

	
	
	



你可能感兴趣的:(SpringMvc常见异常之org.springframework.beans.factory.NoSuchBeanDefinitionException)