<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<!--1. 配置数据源 -->
<bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>com.microsoft.sqlserver.jdbc.SQLServerDriver</value>
</property>
<property name="url">
<value>jdbc:sqlserver://127.0.0.1:1433;DatabaseName=ibatis</value>
</property>
<property name="username">
<value>sa</value>
</property>
<property name="password">
<value>huawei</value>
</property>
</bean>
<!--2. 配置sqlMapClient 相当于hibernate的sessionFactory -->
<bean id="mySqlMapClient"
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation"
value="com/huawei/test/ibatis/SqlMapConfig.xml"/>
<property name="dataSource" ref="myDataSource"/>
</bean>
<!--3. 配置DAO -->
<bean id="MessageDao" class="com.huawei.test.ibatis.dao.MessageDAO">
<property name="dataSource" ref="myDataSource"/>
<property name="sqlMapClient" ref="mySqlMapClient"/>
</bean>
<!--4. 配置服务类 -->
<bean id="MessageServiceImpl"
class="com.huawei.test.ibatis.service.MessageImpl">
<property name="messageDao" ref="MessageDao" />
</bean>
<!--5. 配置事务管理器TransactionManager -->
<bean id="myTransactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="myDataSource"/>
</bean>
<!--6. 配置事务代理 -->
<bean id="abstrac"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
abstract="true">
<property name="transactionManager" ref="myTransactionManager"/>
<property name="transactionAttributes">
<props>
<!--把CustomBuyException减去.说明它即使不是runtimeException,也会rollback-->
<!--把CustomBuyException加上.说明它即使是runtimeException,也不会rollback-->
<prop key="*">-DataAccessException</prop>
</props>
</property>
</bean>
<!-- 继承abstrac 方便多个service来映射 -->
<bean id="messageService" parent="abstrac">
<property name="target" ref="MessageServiceImpl"/>
</bean>
</beans>
分享到:
相关推荐
ibatis-2.3.4.726.jar,ibatis-2.3.0.677.jar,ibatis-2.3.3.720.jar下载,都已放入一个压缩包下。
ibatis-3-core-3.0.0.242.jar.zipibatis-3-core-3.0.0.242.jar.zipibatis-3-core-3.0.0.242.jar.zipibatis-3-core-3.0.0.242.jar.zipibatis-3-core-3.0.0.242.jar.zip
ibatis-sqlmap ibatis-sqlmap-2 ibatis-sqlmap-2.jar.zip
ibatis-core-3.0.jar 找了半天,终于找到了,很好的解决了我的问题,给所需要之人!~
jar包ssi,ssh需要的jar包,hibernate3.jar、ibatis-dao-2.jar、spring.jar、struts.jar、log4j-1.2.9.jar
ibatis-dao-2.jar gggggggggggg
ibatis-2.3.3.720.jar
ibatis-common-2.jar...........
apache开源项目源码ibatis-3-core-src-3.0.0.227 ibatis框架java源程序 spring,struts,hibernate,ibatis,框架源码 各种ibatis框架应用源码,你会从中得到意想不到的效果! apache开源组织开发的开源项目源码,其...
ibatis-3-core-3.0.0.242.zip ibatis-3-core-3.0.0.242.zip ibatis-3-core-3.0.0.242.zip ibatis-3-core-3.0.0.242.zip
ibatis-3-core-3.0.0.200
搭建mybatis所需包org.apache.ibatis.annotations.Param @Param
包括ibatis-common-1.3.1.jar ibatis-common-2.jar
ibatis-2.3.2.715源代码
ibatis-sqlmap-2.jar 对数据库进行操作的jar包 很方便使用
spring-framework-3.0.5.RELEASE-dependencies 好不容易找到了,赶紧分享一下 因为不能大于20M,共分了8个包,都是独立的,我列了目录,可以只下载需要的包,这是1号包: 1号包: edu.emory.mathcs.backport edu.oswego.cs....
ibatis-2.3.3.7.jar
ibatis-2.3.4.726最新API chm格式 非常好用