File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed
framework-docs/modules/ROOT/pages/data-access/transaction/declarative
spring-tx/src/main/java/org/springframework/transaction/annotation Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -86,11 +86,13 @@ rollback rules may be configured via the `rollbackFor`/`noRollbackFor` and
86
86
`rollbackForClassName`/`noRollbackForClassName` attributes, which allow rules to be
87
87
defined based on exception types or patterns, respectively.
88
88
89
- When a rollback rule is defined with an exception type, that type will be used to match
90
- against the type of a thrown exception and its super types, providing type safety and
91
- avoiding any unintentional matches that may occur when using a pattern. For example, a
92
- value of `jakarta.servlet.ServletException.class` will only match thrown exceptions of
93
- type `jakarta.servlet.ServletException` and its subclasses.
89
+ When a rollback rule is defined with an exception type – for example, via `rollbackFor` –
90
+ that type will be used to match against the type of a thrown exception. Specifically,
91
+ given a configured exception type `C`, a thrown exception of type `T` will be considered
92
+ a match against `C` if `T` is equal to `C` or a subclass of `C`. This provides type
93
+ safety and avoids any unintentional matches that may occur when using a pattern. For
94
+ example, a value of `jakarta.servlet.ServletException.class` will only match thrown
95
+ exceptions of type `jakarta.servlet.ServletException` and its subclasses.
94
96
95
97
When a rollback rule is defined with an exception pattern, the pattern can be a fully
96
98
qualified class name or a substring of a fully qualified class name for an exception type
Original file line number Diff line number Diff line change 56
56
* {@link #rollbackForClassName}/{@link #noRollbackForClassName}, which allow
57
57
* rules to be specified as types or patterns, respectively.
58
58
*
59
- * <p>When a rollback rule is defined with an exception type, that type will be
60
- * used to match against the type of a thrown exception and its super types,
61
- * providing type safety and avoiding any unintentional matches that may occur
59
+ * <p>When a rollback rule is defined with an exception type — for example,
60
+ * via {@link #rollbackFor} — that type will be used to match against the
61
+ * type of a thrown exception. Specifically, given a configured exception type
62
+ * {@code C}, a thrown exception of type {@code T} will be considered a match
63
+ * against {@code C} if {@code T} is equal to {@code C} or a subclass of {@code C}.
64
+ * This provides type safety and avoids any unintentional matches that may occur
62
65
* when using a pattern. For example, a value of
63
66
* {@code jakarta.servlet.ServletException.class} will only match thrown exceptions
64
67
* of type {@code jakarta.servlet.ServletException} and its subclasses.
You can’t perform that action at this time.
0 commit comments