<?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>