一、声明式事务管理步骤:
1、配置数据源
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"></property>
<property name="url" value="jdbc:oracle:thin:@192.168.10.3:1521:orcl"></property>
<property name="username" value="yannan"></property>
<property name="password“ value="123456"></property>
</bean>
2、配置事务管理对象
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
3、配置事务策略
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="get*" read-only="true" />
<tx:method name="*" />
</tx:attributes>
</tx:advice>
4、配置AOP
<aop:config>
<aop:pointcut id="busServiceMethods" expression="execution(* org.huawei.business.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="busServiceMethods" />
</aop:config>