今天尝试spring整合mybatis时遇到这么一个问题,就是在配置sqlSessionFactory时是否要配置mapperLocations的问题。 结论是:如果Mapper.xml与Mapper.class在同一个包下且同名,spring扫描Mapper.class的同时会自动扫描同名的Map ...
分类:
移动开发 时间:
2017-11-10 12:55:59
阅读次数:
218
今天尝试spring整合mybatis时遇到这么一个问题,就是在配置sqlSessionFactory时是否要配置mapperLocations的问题。 结论是:如果Mapper.xml与Mapper.class在同一个包下且同名,spring扫描Mapper.class的同时会自动扫描同名的Map ...
分类:
移动开发 时间:
2017-08-16 17:02:21
阅读次数:
252
maven+mybatis+spring在开发的时候,遇到如下错误:org.springframework.beans.factory.UnsatisfiedDependencyException:Errorcreatingbeanwithname‘xxxService’:Unsatisfieddependencyexpressedthroughfield‘xxxMapper’;nestedexceptionisorg.springframework.beans.facto..
分类:
编程语言 时间:
2017-04-05 18:17:35
阅读次数:
493
classpath*:/mybatis-config.xml classpath*:/com/**/sqlmap-*.xml classpath:mybatis/mapper/*.xml classpath:mybatis/ma... ...
分类:
移动开发 时间:
2017-03-21 10:47:27
阅读次数:
2607
开门见山 <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="mapperLocations" value="classpath*:com/mybatis...
分类:
编程语言 时间:
2015-10-29 14:57:04
阅读次数:
200
[MyBatis]mapperLocations属性通配符的使用
分类:
移动开发 时间:
2015-07-17 09:40:28
阅读次数:
625
这一章我们来看看mybaits是怎么读取mapper的xml配置文件并解析其中的sql语句。
我们还记得是这样配置sqlSessionFactory的:
这里配置了一个mapperLocations属性,它是一个表达式,sqlSessionFactory会根据这个表达式读取包com.xxx.mybai...
分类:
移动开发 时间:
2015-02-25 00:44:58
阅读次数:
290