public class TransactionInterceptor extends TransactionAspectSupport implements MethodInterceptor, Serializable
PlatformTransactionManager
/
ReactiveTransactionManager
).
Derives from the TransactionAspectSupport
class which
contains the integration with Spring's underlying transaction API.
TransactionInterceptor simply calls the relevant superclass methods
such as TransactionAspectSupport.invokeWithinTransaction(java.lang.reflect.Method, java.lang.Class<?>, org.springframework.transaction.interceptor.TransactionAspectSupport.InvocationCallback)
in the correct order.
TransactionInterceptors are thread-safe.
TransactionProxyFactoryBean
,
ProxyFactoryBean
,
ProxyFactory
,
Serialized FormTransactionAspectSupport.CoroutinesInvocationCallback, TransactionAspectSupport.InvocationCallback, TransactionAspectSupport.TransactionInfo
logger
Constructor and Description |
---|
TransactionInterceptor()
Create a new TransactionInterceptor.
|
TransactionInterceptor(PlatformTransactionManager ptm,
Properties attributes)
Deprecated.
as of 5.2.5, in favor of
TransactionAspectSupport.setTransactionAttributes(Properties) |
TransactionInterceptor(PlatformTransactionManager ptm,
TransactionAttributeSource tas)
Deprecated.
as of 5.2.5, in favor of
TransactionInterceptor(TransactionManager, TransactionAttributeSource) |
TransactionInterceptor(TransactionManager ptm,
TransactionAttributeSource tas)
Create a new TransactionInterceptor.
|
Modifier and Type | Method and Description |
---|---|
Object |
invoke(MethodInvocation invocation)
Implement this method to perform extra treatments before and
after the invocation.
|
afterPropertiesSet, cleanupTransactionInfo, clearTransactionManagerCache, commitTransactionAfterReturning, completeTransactionAfterThrowing, createTransactionIfNecessary, currentTransactionInfo, currentTransactionStatus, determineTransactionManager, getBeanFactory, getTransactionAttributeSource, getTransactionManager, getTransactionManagerBeanName, invokeWithinTransaction, methodIdentification, prepareTransactionInfo, setBeanFactory, setTransactionAttributes, setTransactionAttributeSource, setTransactionAttributeSources, setTransactionManager, setTransactionManagerBeanName
public TransactionInterceptor()
Transaction manager and transaction attributes still need to be set.
public TransactionInterceptor(TransactionManager ptm, TransactionAttributeSource tas)
ptm
- the default transaction manager to perform the actual transaction managementtas
- the attribute source to be used to find transaction attributesTransactionAspectSupport.setTransactionManager(org.springframework.transaction.TransactionManager)
,
TransactionAspectSupport.setTransactionAttributeSource(org.springframework.transaction.interceptor.TransactionAttributeSource)
@Deprecated public TransactionInterceptor(PlatformTransactionManager ptm, TransactionAttributeSource tas)
TransactionInterceptor(TransactionManager, TransactionAttributeSource)
ptm
- the default transaction manager to perform the actual transaction managementtas
- the attribute source to be used to find transaction attributesTransactionAspectSupport.setTransactionManager(org.springframework.transaction.TransactionManager)
,
TransactionAspectSupport.setTransactionAttributeSource(org.springframework.transaction.interceptor.TransactionAttributeSource)
@Deprecated public TransactionInterceptor(PlatformTransactionManager ptm, Properties attributes)
TransactionAspectSupport.setTransactionAttributes(Properties)
ptm
- the default transaction manager to perform the actual transaction managementattributes
- the transaction attributes in properties formatTransactionAspectSupport.setTransactionManager(org.springframework.transaction.TransactionManager)
,
TransactionAspectSupport.setTransactionAttributes(java.util.Properties)
@Nullable public Object invoke(MethodInvocation invocation) throws Throwable
MethodInterceptor
Joinpoint.proceed()
.invoke
in interface MethodInterceptor
invocation
- the method invocation joinpointJoinpoint.proceed()
;
might be intercepted by the interceptorThrowable
- if the interceptors or the target object
throws an exception