Improve wording for transactional rollback rule semantics

Closes gh-35346
This commit is contained in:
Sam Brannen
2025-08-19 13:32:35 +02:00
parent 68762b5f86
commit 5d325ca0fc
2 changed files with 13 additions and 8 deletions
@@ -86,11 +86,13 @@ rollback rules may be configured via the `rollbackFor`/`noRollbackFor` and
`rollbackForClassName`/`noRollbackForClassName` attributes, which allow rules to be
defined based on exception types or patterns, respectively.
When a rollback rule is defined with an exception type, that type will be used to match
against the type of a thrown exception and its super types, providing type safety and
avoiding any unintentional matches that may occur when using a pattern. For example, a
value of `jakarta.servlet.ServletException.class` will only match thrown exceptions of
type `jakarta.servlet.ServletException` and its subclasses.
When a rollback rule is defined with an exception type – for example, via `rollbackFor` –
that type will be used to match against the type of a thrown exception. Specifically,
given a configured exception type `C`, a thrown exception of type `T` will be considered
a match against `C` if `T` is equal to `C` or a subclass of `C`. This provides type
safety and avoids any unintentional matches that may occur when using a pattern. For
example, a value of `jakarta.servlet.ServletException.class` will only match thrown
exceptions of type `jakarta.servlet.ServletException` and its subclasses.
When a rollback rule is defined with an exception pattern, the pattern can be a fully
qualified class name or a substring of a fully qualified class name for an exception type
@@ -56,9 +56,12 @@ import org.springframework.transaction.TransactionDefinition;
* {@link #rollbackForClassName}/{@link #noRollbackForClassName}, which allow
* rules to be specified as types or patterns, respectively.
*
* <p>When a rollback rule is defined with an exception type, that type will be
* used to match against the type of a thrown exception and its super types,
* providing type safety and avoiding any unintentional matches that may occur
* <p>When a rollback rule is defined with an exception type &mdash; for example,
* via {@link #rollbackFor} &mdash; that type will be used to match against the
* type of a thrown exception. Specifically, given a configured exception type
* {@code C}, a thrown exception of type {@code T} will be considered a match
* against {@code C} if {@code T} is equal to {@code C} or a subclass of {@code C}.
* This provides type safety and avoids any unintentional matches that may occur
* when using a pattern. For example, a value of
* {@code jakarta.servlet.ServletException.class} will only match thrown exceptions
* of type {@code jakarta.servlet.ServletException} and its subclasses.