直接删除Mybatis的配置文件,修改Beans.xml文件的sqlSessionFactory的参数内容,如下:

<!--配置sqlSessionFactory-->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mapperLocations" value="classpath:com/lxy/entity/*Mapper.xml"/>
<property name="configLocation" value=""/>
</bean>

修改Mapper.xml的别名,改用路径+类名,如下:

<mapper namespace="com.lxy.entity.UserMapper">
<select id="selectUsers" resultType="com.lxy.entity.User">
select * from users
</select>
<insert id="add" parameterType="com.lxy.entity.User" useGeneratedKeys="true">
insert into users(name,pwd) values(#{name},#{pwd})
</insert>
<delete id="remove">
delete from users where id=#{id}
</delete>
</mapper>

MyBatis-Spring整合之方式4的更多相关文章

  1. springMVC+mybatis+spring整合案例

    1.web.xml a:配置spring监听,使web容器在启动时加载spring的applicationContext.xml <listener> <listener-class ...

  2. springMVC+MyBatis+Spring 整合(3)

    spring mvc 与mybatis 的整合. 加入配置文件: spring-mybaits.xml <?xml version="1.0" encoding=" ...

  3. SpringMVC+Mybatis+Spring整合

    Maven引入需要的JAR包 pom.xml <properties> <!-- spring版本号 --> <spring.version>4.0.2.RELEA ...

  4. MyBatis Spring整合配置映射接口类与映射xml文件

    本文转自http://blog.csdn.net/zht666/article/details/38706083 Spring整合MyBatis使用到了mybatis-spring,在配置mybati ...

  5. Mybatis——Spring整合

    一.引入依赖 Spring的相关jar包 mybatis-3.4.1.jar mybatis-spring-1.3.0.jar mysql-connector-java-5.1.37-bin.jar ...

  6. springMVC+MyBatis+Spring 整合(4) ---解决Spring MVC 对AOP不起作用的问题

    解决Spring MVC 对AOP不起作用的问题 分类: SpringMVC3x+Spring3x+MyBatis3x myibaits spring J2EE2013-11-21 11:22 640 ...

  7. Mybatis+Spring整合后Mapper测试类编写

    public class UserMapperTest { private ApplicationContext applicationContext; @Before public void ini ...

  8. springmvc+mybatis+spring 整合源码项目

    A集成代码生成器 [正反双向(单表.主表.明细表.树形表,开发利器)+快速构建表单; freemaker模版技术 ,0个代码不用写,生成完整的一个模块,带页面.建表sql脚本,处理类,service等 ...

  9. springmvc+mybatis+spring 整合

    获取[下载地址]   [免费支持更新]三大数据库 mysql  oracle  sqlsever   更专业.更强悍.适合不同用户群体[新录针对本系统的视频教程,手把手教开发一个模块,快速掌握本系统] ...

  10. springmvc+mybatis+spring 整合 bootstrap

    获取[下载地址]   [免费支持更新]三大数据库 mysql  oracle  sqlsever   更专业.更强悍.适合不同用户群体[新录针对本系统的视频教程,手把手教开发一个模块,快速掌握本系统] ...

随机推荐

  1. STL-vector-set_difference B - 人见人爱A-B

    B - 人见人爱A-B 参加过上个月月赛的同学一定还记得其中的一个最简单的题目,就是{A}+{B},那个题目求的是两个集合的并集,今天我们这个A-B求的是两个集合的差,就是做集合的减法运算.(当然,大 ...

  2. [ C++ ] 常用位运算技巧

    1.除以二 a >> 1 2.二的n次方 1 << n 3.十进制转2进制 x&(1<<i) 持续更新

  3. adb server version (xx) doesn't match this client (xx); killing...

    问题 查看AndroidSDK的adb版本 查看模拟器adb的版本号 安装路径/bin目录下的 nox_adb.exe 将AndroidSDK的adb复制出来,重命名为nox_adb.exe,覆盖模拟 ...

  4. Java Set集合的详解

    一,Set Set:注重独一无二的性质,该体系集合可以知道某物是否已近存在于集合中,不会存储重复的元素 用于存储无序(存入和取出的顺序不一定相同)元素,值不能重复. 对象的相等性 引用到堆上同一个对象 ...

  5. 简单易用,用Powershell劫持Windows系统快捷键

    POC:  $WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut("des ...

  6. 组合数的计算以及组合数对p取余后结果的计算

    前奏:统计 n! 中的所有质因子中pi的个数 普通方法:复杂度O(nlogn), 当n为10的18次方无法承受 // 复杂度O(nlogn), n为10的18次方无法承受 int cal(int n, ...

  7. 记录 shell学习过程(5)continue break

    1.continue ;i<;i++)) do ];then continue fi echo $i done # ./continue.sh12346789 2.break ;i<;i+ ...

  8. linq和转换运算符

    1.ToArray 两种常用用法 使用ILSPY查看Enumerable中的ToArray 源码分析:我们发现如果该类型可以转化为ICollection,我们最后执行CopyTo方法,如果不能转换为I ...

  9. 一些好用的Jquery插件

    1.jquery.resizableColumns.min.js,可以给table列加上调节宽度的功能 2.Jquery.cookie.js,可以在客户端写入和获取cookie 3.Paginatio ...

  10. 期货homes平台以及仿ctp接口

    实盘账户或者模拟账户可以下挂多个子账户 子账户也可以是homes母账户,理论上可以一层一层套下去. 所有交易细节全部保存,收盘定时结算. 功能很强大,并且还有很多拓展空间. 连接homes平台,需要用 ...