xml配置

<?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:util="http://www.springframework.org/schema/util"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-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/task http://www.springframework.org/schema/task/spring-task-3.0.xsd"
default-lazy-init="true">

<!-- spring对ibatis配置文件读取的实现,指定ibatis配置文件的目录,配置文件只需放置有哪些实体的xml所在位置 -->
<bean id="backlego.orm.dao.SqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"
scope="singleton">
<property name="configLocations">
<list>
<value>classpath*:conf/dao/*SqlMapConfig.xml</value>
<value>classpath*:config/dao/*SqlMapConfig.xml</value>
<value>classpath*:META-INF/dao/*SqlMapConfig.xml</value>
</list>
</property>
<property name="transactionConfigClass"
value="com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransactionConfig" />
<property name="dataSource" ref="backlego.db.DataSource" />
</bean>

<!-- spring托管的dao,数据库事务由spring控制 -->
<bean id="backlego.orm.dao.BaseDao" class="com.huawei.backlego.orm.dao.impl.BaseDaoImpl"
abstract="true">
<property name="sqlMapClient" ref="backlego.orm.dao.SqlMapClient" />
<property name="dbTypes" ref="backlego.orm.dao.DbTypes" />
</bean>

<!-- 原生ibatis dao,数据库事务需要显示开启、提交、关闭 -->
<bean id="backlego.orm.dao.IBatisDao" class="com.huawei.backlego.orm.dao.impl.IBatisDaoImpl"
abstract="true">
<property name="sqlMapClient" ref="backlego.orm.dao.SqlMapClient" />
<property name="dbTypes" ref="backlego.orm.dao.DbTypes" />
</bean>

<bean id="backlego.orm.healthmonitor.dao.DBCheckDao"
class="com.huawei.backlego.orm.healthmonitor.dao.impl.DBCheckDaoImpl"
parent="backlego.orm.dao.IBatisDao">
<property name="nameSpace" value="DBCheck" />
</bean>

<bean id="backlego.orm.dao.DbTypes" class="org.springframework.beans.factory.config.MapFactoryBean">
<property name="targetMapClass">
<value>java.util.HashMap</value>
</property>
<property name="sourceMap">
<map>
<entry key="com.mysql.jdbc.Driver" value="mysql" />
<entry key="com.ibm.db2.jcc.DB2Driver" value="db2" />
<entry key="org.h2.Driver" value="h2" />
<entry key="oracle.jdbc.driver.OracleDriver" value="oracle" />
</map>
</property>
</bean>
</beans>

转载于:https://www.cnblogs.com/imhero0314/p/6424372.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值