【今天感悟】
需要事务管理和aop切面编程联合组成事务。
导入依赖
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>5.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.0.2.RELEASE</version>
</dependency>
<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="find" isolation="DEFAULT" propagation="SUPPORTS" read-only="true"/>
<tx:method name="" isolation="DEFAULT" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>