1. BeanCreationException
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userManagerController': Injection of autowired dependencies failed
在tomcat catelina log
中发现
org.mybatis.spring.mapper.ClassPathMapperScanner.doScan No MyBatis mapper was found in '[com.mmall.dao]' package. Please check your configuration.
解决:
applicationContext-datasource.xml
里配置mapperScannerConfigurer
<bean name="mapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.mall.dao"/>
</bean>
2. Could not open ServletContext resource [/WEB-INF/dispatcher-servlet.xml]
在maven项目中 web.xml和applicationContext.xml两个文件没放一起
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</init-param>
网友评论