注解配置事务管理
@Transaction
<!--
@Transactional: 注解配置事务
1。事务管理器
注意:约定写法:
id=transactionManager
2。注解驱动
-->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
<tx:annotation-driven></tx:annotation-driven>
@Transaction可以定义接口,接口方法,类, 类的公共方法
You can place the @Transactional annotation before an interface definition, a method on an interface, a class definition, or a public method on a class.
但是: 定义在接口上和接口方法中是不靠谱的。
Table 16.2. Annotation driven transaction settings
<tx:annotation-driven mode="aspectj" transaction-manager="transactionManager"
proxy-target-class="false"></tx:annotation-driven>