File tree 2 files changed +13
-1
lines changed
spring-tx/src/main/java/org/springframework/transaction/annotation 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 27
27
import org .springframework .transaction .TransactionDefinition ;
28
28
29
29
/**
30
- * Describes transaction attributes on a method or class.
30
+ * Describes a transaction attribute on an individual method or on a class.
31
+ *
32
+ * <p>At the class level, this annotation applies as a default to all methods of
33
+ * the declaring class and its subclasses. Note that it does not apply to ancestor
34
+ * classes up the class hierarchy; methods need to be locally redeclared in order
35
+ * to participate in a subclass-level annotation.
31
36
*
32
37
* <p>This annotation type is generally directly comparable to Spring's
33
38
* {@link org.springframework.transaction.interceptor.RuleBasedTransactionAttribute}
Original file line number Diff line number Diff line change @@ -1090,6 +1090,12 @@ following class definition:
1090
1090
}
1091
1091
----
1092
1092
1093
+ Used at the class level as above, the annotation indicates a default for all methods
1094
+ of the declaring class (as well as its subclasses). Alternatively, each method can
1095
+ get annotated individually. Note that a class-level annotation does not apply to
1096
+ ancestor classes up the class hierarchy; in such a scenario, methods need to be
1097
+ locally redeclared in order to participate in a subclass-level annotation.
1098
+
1093
1099
When the above POJO is defined as a bean in a Spring IoC container, the bean instance
1094
1100
can be made transactional by adding merely __one__ line of XML configuration:
1095
1101
@@ -1115,6 +1121,7 @@ can be made transactional by adding merely __one__ line of XML configuration:
1115
1121
1116
1122
<!-- enable the configuration of transactional behavior based on annotations -->
1117
1123
__<tx:annotation-driven transaction-manager="txManager"/>__<!-- a PlatformTransactionManager is still required -->
1124
+
1118
1125
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
1119
1126
<!-- (this dependency is defined somewhere else) -->
1120
1127
<property name="dataSource" ref="dataSource"/>
You can’t perform that action at this time.
0 commit comments