读书人

Spring 配置文件(组合ibatis)

发布时间: 2013-01-17 10:28:54 作者: rapoo

Spring 配置文件(结合ibatis)
<?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/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<!-- <bean id="propertyConfigurer"
value="oracle.jdbc.driver.OracleDriver"></property>
<property name="username" value="scott"></property>
<property name="password" value="tiger"></property>
<property name="url" value="jdbc:oracle:thin:@10.4.115.71:1521:orcl"></property>
<property name="maxActive" value="100"></property>
<property name="maxIdle" value="20"></property>
<property name="maxWait" value="1000"></property>
</bean>
<!-- 事务配置 -->
<bean id="transactionManager"
ref="dataSource"/>
</bean>
<!-- 代理基类 -->
<bean id="txProxyTemplate" abstract="true"
/>
</property>
<property name="transactionAttributes">
<props>
<prop key="do*">PROPAGATION_REQUIRED,-Exception</prop>
</props>
</property>
</bean>
<!-- Spring 和 iBatis 的融合 -->
<!-- 根据数据访问资源,实例化SqlMapClient对象 -->
<bean id="baseSqlMapClient" value="classpath:../config/SqlMapconfig.xml"/>
<property name="dataSource" ref="dataSource"/>
</bean>
<!-- 创建sqlMapClientTemplate -->
<bean id="baseSqlMapClientTemplate" ref="baseSqlMapClientTemplate"/>
</bean>
<!-- 实例化实体DAO,注入BaseDAO -->
<bean id="testDao" parent="baseDAO"/>
<!-- BO配置 -->
<bean id="testBo" parent="txProxyTemplate">
<property name="target">
<bean ref="testDao"></property>
</bean>
</property>
</bean>
<!-- action配置 -->
<bean name="/empInformation"
ref="testBo"></property>
</bean>
</beans>

读书人网 >Web前端

热点推荐