mybatis3 spring cxf

  在使用过hibernate ibatis 之后,还是喜欢ibatis的那种写原生态的SQL, 便追随着ibatis来到mybatis.

  由于spring3的发布在mybatis3之前,所以并没有对mybatis3提供官方支持. 于是便引出了mybatis-spring*.jar(由mybats的官方提供)

  由于项目是C/S 架构的,我选用cxf将服务发不成webservice,再用spring管理mybatis的sessionfactory.

  各配置如下:

在applicationContext-beans.xml中:

      <bean id="baseDao" class="org.mybatis.spring.mapper.MapperFactoryBean">
        <property name="sqlSessionFactory" ref="sqlSessionFactory" />
        <property name="mapperInterface" value="com.socogame.base.dao.IBaseDao" />
    </bean> 


     <bean id="gameDao" parent="baseDao">
      <property name="mapperInterface" value="com.socogame.dao.IGameDao" />
</bean>
 
<bean id="gameLogic" class="com.socogame.logic.GameLogic">
     <property name="gameDao" ref="gameDao" />
</bean>


   在bean.xml中: 

    <bean id="gameService"   class="com.socogame.service.impl.GameServiceImpl" >
     <property name="gameLogic" ref="gameLogic" />
  </bean>

   <jaxws:endpoint id="gameServiceWs" address="/gameService" implementor="#gameService" />


代码见附件,不能传附件,见链接: http://download.csdn.net/detail/lesblueleaves/4305589

另附客户端代码,gamews为安卓代码,我是选用ksoap2包调用webservice  链接:http://download.csdn.net/detail/lesblueleaves/4305562

p.s  在下才疏学浅,恳请高手指点一二...

  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值