使用 Spring 简化 MyBatis(不完全)

导入 mybatis 所有jar和spring基本包,spring-jdbc,spring-tx,spring-aopspring-web,spring整合mybatis的包等

先配置 web.xml
配置spring配置文件

  • 编写代码
    • 正常编写 pojo
    • 编写 mapper 包下时必须使用接口绑定方案或注解方案(必须有接口)
    • 正常编写 Service 接口和 Service 实现类
    • 需要在 Service 实现类中声明 Mapper 接口对象,并生成get/set 方法
- **spring 无法管理 Servlet,在 service 中取出 Servie 对象**
![](https://qiniu.codekylin.cn/img/20200405111636.png)