您的当前位置:首页正文

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托管的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

因篇幅问题不能全部显示,请点此查看更多更全内容

Top