<数据源配置Begin>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
<value>classpath:cache.properties</value>
<value>classpath:config.properties</value>
</list>
</property>
</bean>
<bean id="basicDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<value>${jdbc.driverClassName}</value>
</property>
<property name="url">
<value>${jdbc.url}</value>
</property>
<property name="username">
<value>${jdbc.username}</value>
</property>
<property name="password">
<value>${jdbc.password}</value>
</property>
<property name="initialSize">
<value>${jdbc.initialSize}</value>
</property>
<property name="maxActive">
<value>${jdbc.maxActive}</value>
</property>
<property name="maxIdle">
<value>${jdbc.maxIdle}</value>
</property>
</bean>
<数据源配置End>
<spring事务控制Begin>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="basicDataSource"> </property>
</bean>
<自动检测到的事物管理器使用标准名称transactionManager,因此无需显示指定transaction-manager属性>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" rollback-for="Throwable"/>
<tx:method name="edit*" propagation="REQUIRED" rollback-for="Throwable"/>
<tx:method name="remove*" propagation="REQUIRED" rollback-for="Throwable"/>
<tx:method name="save*" propagation="REQUIRED" rollback-for="Throwable"/>
<tx:method name="insert*" propagation="REQUIRED" rollback-for="Throwable"/>
<tx:method name="delete*" propagation="REQUIRED" rollback-for="Throwable"/>
<tx:method name="update*" propagation="REQUIRED" rollback-for="Throwable"/>
<tx:method name="*_TA" propagation="REQUIRED" rollback-for="Throwable"/>
<tx:method name="*" read-only="true">
<tx:attributes>
</tx:advice>
<aop:cofig>
<aop:pointcut id="shoppingAllMethod" expression="(execution(* *..service.impl.*.*(..)))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="shoppingAllMethod"/>
</aop:config>
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocations">
<list>
<value>classpath:*.xml</value>
<value>classpath:</value>
<value>classpath:</value>
</list
</property>
<property name="dataSource" ref="basicDataSource"></property>
</bean>
<创建sqlMapClientTemplate>
<bean id="sqlMapClientTemplate" class="org.springframework.orm.ibatis.SqlMapClientTemplate">
<constructor-arg>
<ref bean="sqlMapClient">
</constructor-arg>
</bean>
<创建jdbcTemplate>
<bean id="jdbcTemple" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="basicDataSource" />
</bean>