在整合過程中如果遇到:
org.springframework.beans.factory.NoSuchBeanDefinitionException:
No matching bean of type [com.Dao.UserDao] 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)}
那麼可以優先查看你的web.xml監聽器是否被啓動
我的監聽器代碼
<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:applicationContext.xml</param-value> </context-param>
添加上後問題解決