Spring JDBC Transaction Spring 3.0.6 事务配置

<context:annotation-config></context:annotation-config>
<context:component-scan base-package="com.frank.test.dao.*"></context:component-scan>
<context:component-scan base-package="com..frank.test.service.*"></context:component-scan>

<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

<property name="locations">
<list>
<value>classpath:conf/jdbc.properties</value>
<value>classpath:conf/log4j.properties</value>
</list>
</property>
</bean>

<bean id="simpleJdbcTemplate" class="org.springframework.jdbc.core.simple.SimpleJdbcTemplate">
<constructor-arg>
<ref bean="dataSource" />
</constructor-arg>
</bean>

<bean id="dataSource" class="org.logicalcobwebs.proxool.ProxoolDataSource">
<property name="driver">
<value>${proxool.driver}</value>
</property>
<property name="driverUrl">
<value>${proxool.url}</value>
</property>
<property name="user">
<value>${proxool.username}</value>
</property>
<property name="password">
<value>${proxool.password}</value>
</property>
<property name="alias">
<value>${proxool.alias}</value>
</property>
<property name="prototypeCount">
<value>${proxool.prototypeCount}</value>
</property>
<property name="maximumConnectionCount">
<value>${proxool.maximumConnectionCount}</value>
</property>
<property name="minimumConnectionCount">
<value>${proxool.minimumConnectionCount}</value>
</property>
<property name="trace">
<value>${proxool.trace}</value>
</property>
<property name="verbose">
<value>${proxool.verbose}</value>
</property>
</bean>

<!-- Transaction Configuration start -->

<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>

<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="get*" read-only="true"/>
<tx:method name="find*" read-only="true"/>
<tx:method name="*"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="allServiceOperation" expression="execution(* com.frank.test.service.I*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="allServiceOperation"/>
</aop:config>

注意:

匹配格式: com.frank.test.service.I*(接口名).*(..)

 

你可能感兴趣的:(transaction)