Class DmxTransactionalAspect
java.lang.Object
dmx.fun.spring.DmxTransactionalAspect
Spring AOP aspect that backs the
TransactionalResult, TransactionalTry,
and TransactionalValidated annotations.
Intercepts annotated methods and delegates to TxExecutor with a
TransactionDefinition built from the annotation
attributes. The transaction commits on a success value and rolls back on a failure value
or an unchecked exception.
Register this bean and enable AspectJ auto-proxying in your Spring context:
@Configuration
@EnableAspectJAutoProxy
public class AppConfig {
@Bean
public DmxTransactionalAspect dmxTransactionalAspect(
PlatformTransactionManager txManager, BeanFactory beanFactory) {
return new DmxTransactionalAspect(txManager, beanFactory);
}
}
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDmxTransactionalAspect(org.springframework.transaction.PlatformTransactionManager txManager, org.springframework.beans.factory.BeanFactory beanFactory) Creates the aspect backed by the given transaction manager and bean factory. -
Method Summary
Modifier and TypeMethodDescriptionaroundResult(org.aspectj.lang.ProceedingJoinPoint pjp, TransactionalResult ann) Runs the annotated method inside a transaction and rolls back if the returnedResultis an error.aroundTry(org.aspectj.lang.ProceedingJoinPoint pjp, TransactionalTry ann) Runs the annotated method inside a transaction and rolls back if the returnedTryis a failure.aroundValidated(org.aspectj.lang.ProceedingJoinPoint pjp, TransactionalValidated ann) Runs the annotated method inside a transaction and rolls back if the returnedValidatedis invalid.
-
Constructor Details
-
DmxTransactionalAspect
public DmxTransactionalAspect(org.springframework.transaction.PlatformTransactionManager txManager, org.springframework.beans.factory.BeanFactory beanFactory) Creates the aspect backed by the given transaction manager and bean factory.- Parameters:
txManager- the default transaction manager used when no bean name is specified in the annotation; must not benullbeanFactory- the factory used to look up named transaction managers; must not benull
-
-
Method Details
-
aroundResult
-
aroundTry
-
aroundValidated
-