ssm项目又来一个低级错误,粗心粗心
异常信息:
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property ‘mapperLocation’ of bean class [org.mybatis.spring.SqlSessionFactoryBean]: Bean property ‘mapperLocation’ is not writable or has an invalid setter method. Did you mean ‘mapperLocations’?
分析原因:
异常信息提示属性无效 ,出现这个错误,检查applicationContexe.xml文件中对应的属性
(原本ide有自动提示,结果没用,自己写导致写错)
**
出现错误原因:
**
在applicationContext.xml配置sqlSessionFactory时不小心将<property 中的name=xxx属性写错>
解决:
将mapperLocations 错写成mapperLocation ,找到对应的属性改正即可
<property name="mapperLocations" value="classpath:mappers/**/*.xml"/>