Annotation Interface TransactionalValidated
Declarative transaction annotation for methods that return
Validated.
When applied to a method, DmxTransactionalAspect intercepts the call and
runs the body inside a Spring-managed transaction. The transaction commits when the
method returns Validated.isValid() and rolls back when it returns
Validated.isInvalid() or when an unchecked exception escapes.
Quick start
@Service
public class RegistrationService {
@TransactionalValidated
public Validated<NonEmptyList<String>, User> register(RegistrationRequest req) {
return validateName(req)
.combine(validateEmail(req), UserDraft::new)
.map(repo::save);
}
}
Requires DmxTransactionalAspect to be registered as a Spring bean and
@EnableAspectJAutoProxy (or equivalent) active in the application context.
- See Also:
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionorg.springframework.transaction.annotation.IsolationTransaction isolation level.org.springframework.transaction.annotation.PropagationTransaction propagation behavior.booleanWhether the transaction is read-only.intTransaction timeout in seconds.Bean name of a specificPlatformTransactionManagerto use.
-
Element Details
-
propagation
org.springframework.transaction.annotation.Propagation propagationTransaction propagation behavior.- Returns:
- propagation setting; defaults to
Propagation.REQUIRED
- Default:
REQUIRED
-
isolation
org.springframework.transaction.annotation.Isolation isolationTransaction isolation level.- Returns:
- isolation level; defaults to
Isolation.DEFAULT
- Default:
DEFAULT
-
timeout
int timeoutTransaction timeout in seconds.- Returns:
- timeout in seconds; defaults to
TransactionDefinition.TIMEOUT_DEFAULT(no explicit timeout)
- Default:
-1
-
readOnly
boolean readOnlyWhether the transaction is read-only.A read-only hint allows the underlying JDBC driver or ORM to apply optimizations (e.g., skip dirty checking, use a read replica). It does not prevent writing statements — enforcement depends on the actual transaction manager and data source.
- Returns:
trueto request a read-only transaction; defaults tofalse
- Default:
false
-
transactionManager
String transactionManagerBean name of a specificPlatformTransactionManagerto use.- Returns:
- bean name; defaults to
""which selects the primaryPlatformTransactionManagerin the context
- Default:
""
-