Class TransactionInterceptor
java.lang.Object
org.springframework.transaction.interceptor.TransactionAspectSupport
org.springframework.transaction.interceptor.TransactionInterceptor
- All Implemented Interfaces:
- Serializable,- Advice,- Interceptor,- MethodInterceptor,- Aware,- BeanFactoryAware,- InitializingBean
public class TransactionInterceptor
extends TransactionAspectSupport
implements MethodInterceptor, Serializable
AOP Alliance MethodInterceptor for declarative transaction
 management using the common Spring transaction infrastructure
 (
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.
- Author:
- Rod Johnson, Juergen Hoeller, Sebastien Deleuze
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class org.springframework.transaction.interceptor.TransactionAspectSupportTransactionAspectSupport.CoroutinesInvocationCallback, TransactionAspectSupport.InvocationCallback, TransactionAspectSupport.TransactionInfo
- 
Field SummaryFields inherited from class org.springframework.transaction.interceptor.TransactionAspectSupportlogger
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a new TransactionInterceptor.TransactionInterceptor(PlatformTransactionManager ptm, Properties attributes) Deprecated.Deprecated.as of 5.2.5, in favor ofTransactionInterceptor(TransactionManager, TransactionAttributeSource)Create a new TransactionInterceptor.
- 
Method SummaryModifier and TypeMethodDescriptioninvoke(MethodInvocation invocation) Implement this method to perform extra treatments before and after the invocation.Methods inherited from class org.springframework.transaction.interceptor.TransactionAspectSupportafterPropertiesSet, cleanupTransactionInfo, clearTransactionManagerCache, commitTransactionAfterReturning, completeTransactionAfterThrowing, createTransactionIfNecessary, currentTransactionInfo, currentTransactionStatus, determineTransactionManager, determineTransactionManager, getBeanFactory, getTransactionAttributeSource, getTransactionManager, getTransactionManagerBeanName, invokeWithinTransaction, methodIdentification, prepareTransactionInfo, setBeanFactory, setTransactionAttributes, setTransactionAttributeSource, setTransactionAttributeSources, setTransactionManager, setTransactionManagerBeanName
- 
Constructor Details- 
TransactionInterceptorpublic TransactionInterceptor()Create a new TransactionInterceptor.Transaction manager and transaction attributes still need to be set. 
- 
TransactionInterceptorCreate a new TransactionInterceptor.- Parameters:
- ptm- the default transaction manager to perform the actual transaction management
- tas- the attribute source to be used to find transaction attributes
- Since:
- 5.2.5
- See Also:
 
- 
TransactionInterceptor@Deprecated public TransactionInterceptor(PlatformTransactionManager ptm, TransactionAttributeSource tas) Deprecated.as of 5.2.5, in favor ofTransactionInterceptor(TransactionManager, TransactionAttributeSource)Create a new TransactionInterceptor.- Parameters:
- ptm- the default transaction manager to perform the actual transaction management
- tas- the attribute source to be used to find transaction attributes
- See Also:
 
- 
TransactionInterceptorDeprecated.as of 5.2.5, in favor ofTransactionAspectSupport.setTransactionAttributes(Properties)Create a new TransactionInterceptor.- Parameters:
- ptm- the default transaction manager to perform the actual transaction management
- attributes- the transaction attributes in properties format
- See Also:
 
 
- 
- 
Method Details- 
invokeDescription copied from interface:MethodInterceptorImplement this method to perform extra treatments before and after the invocation. Polite implementations would certainly like to invokeJoinpoint.proceed().- Specified by:
- invokein interface- MethodInterceptor
- Parameters:
- invocation- the method invocation joinpoint
- Returns:
- the result of the call to Joinpoint.proceed(); might be intercepted by the interceptor
- Throws:
- Throwable- if the interceptors or the target object throws an exception
 
 
- 
TransactionAspectSupport.setTransactionAttributes(Properties)