Spring3 整合 Mybatis3
这两天,项目需要使用spring+ibatis,于是去网上下载了,结果发现和之前我用的版本变化不小,整了两天才将功能实现,不敢怠慢,赶紧写份博客记录一下。
首先是依赖的库:

接着是web.xml的配置,这里,我使用的是Spring3 MVC
[html]
< xml version="1.0" encoding="UTF-8" >
然后是spring的servlet配置servlet-config.xml:
[html] view plaincopy
< xml version="1.0" encoding="UTF-8" >
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
然后是Spring的Bean的配置文件applicationContext.xml:
[html]
< xml version="1.0" encoding="UTF-8" >
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">