今天第一次整合spring和mybatis,可谓是历程坎坷,前后历时3个小时才整合完成,各种错误加起来恐怕有几十个,尤其是导包的环节。
现在吧今天的成果贴出来,也算是对得起自己的这3个小时了,下面是整体的结构
这是spring的控制文件applicationContext.xml(悲剧的事情就是居然把有关数据的配置都放到了这里,这不是抢mybatis的饭碗吗,搞得我花了三个小时才想到!)
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<!--创建jdbc数据源 -->
<bean id="dataSource"