spring4.x中没有sqlmapclientdaosupport,被什么替代了
1个回答
展开全部
在spring 内配置
!-- 配置mybatis -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:xxxxx.xml"></property>
<!-- mapper扫描 -->
<property name="mapperLocations" value="classpath:xxxx/*/*.xml"></property>
</bean>
<bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg ref="sqlSessionFactory" />
</bean>
调用
@Resource(name = "sqlSessionTemplate")
private SqlSessionTemplate sqlSessionTemplate;
!-- 配置mybatis -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:xxxxx.xml"></property>
<!-- mapper扫描 -->
<property name="mapperLocations" value="classpath:xxxx/*/*.xml"></property>
</bean>
<bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg ref="sqlSessionFactory" />
</bean>
调用
@Resource(name = "sqlSessionTemplate")
private SqlSessionTemplate sqlSessionTemplate;
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询