Top Description Fields Constructors Methods
org.springframework.transaction.interceptor

public Class TransactionInterceptor

extends TransactionAspectSupport
implements MethodInterceptor, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.aopalliance.intercept.MethodInterceptor, org.aopalliance.intercept.Interceptor, org.aopalliance.aop.Advice
Annotations
@SuppressWarnings:serial
Imports
java.io.IOException, .ObjectInputStream, .ObjectOutputStream, .Serializable, java.util.Properties, org.aopalliance.intercept.MethodInterceptor, .MethodInvocation, org.springframework.aop.support.AopUtils, org.springframework.beans.factory.BeanFactory, org.springframework.lang.Nullable, org.springframework.transaction.PlatformTransactionManager, .TransactionManager

AOP Alliance MethodInterceptor for declarative transaction management using the common Spring transaction infrastructure (org.springframework.transaction.PlatformTransactionManager/ org.springframework.transaction.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 invokeWithinTransaction in the correct order.

TransactionInterceptors are thread-safe.

Authors
Rod Johnson, Juergen Hoeller, Sebastien Deleuze
See Also
TransactionProxyFactoryBean, org.springframework.aop.framework.ProxyFactoryBean, org.springframework.aop.framework.ProxyFactory

Field Summary

Inherited from org.springframework.transaction.interceptor.TransactionAspectSupport:
logger

Constructor Summary

AccessConstructor and Description
public
TransactionInterceptor()

Create a new TransactionInterceptor.

public
TransactionInterceptor(TransactionManager
the default transaction manager to perform the actual transaction management
ptm
,
TransactionAttributeSource
the attribute source to be used to find transaction attributes
tas
)

Create a new TransactionInterceptor.

public
TransactionInterceptor(PlatformTransactionManager
the default transaction manager to perform the actual transaction management
ptm
,
TransactionAttributeSource
the attribute source to be used to find transaction attributes
tas
)

Create a new TransactionInterceptor.
public
TransactionInterceptor(PlatformTransactionManager
the default transaction manager to perform the actual transaction management
ptm
,
Properties
the transaction attributes in properties format
attributes
)

Deprecated as of 5.2.5, in favor of setTransactionAttributes(Properties)
Create a new TransactionInterceptor.

Method Summary

Modifier and TypeMethod and Description
public Object
invoke(MethodInvocation
the method invocation joinpoint
invocation
)

Implements org.aopalliance.intercept.MethodInterceptor.invoke.

Implement this method to perform extra treatments before and after the invocation.
private void
private void
Inherited from org.springframework.transaction.interceptor.TransactionAspectSupport:
afterPropertiesSetcleanupTransactionInfoclearTransactionManagerCachecommitTransactionAfterReturningcompleteTransactionAfterThrowingcreateTransactionIfNecessarycurrentTransactionInfocurrentTransactionStatusdetermineTransactionManagergetBeanFactorygetTransactionAttributeSourcegetTransactionManagergetTransactionManagerBeanNameinvokeWithinTransactionmethodIdentificationprepareTransactionInfosetBeanFactorysetTransactionAttributessetTransactionAttributeSourcesetTransactionAttributeSourcessetTransactionManagersetTransactionManagerBeanName

Constructor Detail

TransactionInterceptorback to summary
public TransactionInterceptor()

Create a new TransactionInterceptor.

Transaction manager and transaction attributes still need to be set.

See Also
setTransactionManager, setTransactionAttributes(java.util.Properties), setTransactionAttributeSource(TransactionAttributeSource)
TransactionInterceptorback to summary
public TransactionInterceptor(TransactionManager ptm, TransactionAttributeSource tas)

Create a new TransactionInterceptor.

Parameters
ptm:TransactionManager

the default transaction manager to perform the actual transaction management

tas:TransactionAttributeSource

the attribute source to be used to find transaction attributes

Since
5.2.5
See Also
setTransactionManager, setTransactionAttributeSource
TransactionInterceptorback to summary
public TransactionInterceptor(PlatformTransactionManager ptm, TransactionAttributeSource tas)

Create a new TransactionInterceptor.

Parameters
ptm:PlatformTransactionManager

the default transaction manager to perform the actual transaction management

tas:TransactionAttributeSource

the attribute source to be used to find transaction attributes

Annotations
@Deprecated
See Also
setTransactionManager, setTransactionAttributeSource
TransactionInterceptorback to summary
public TransactionInterceptor(PlatformTransactionManager ptm, Properties attributes)

Deprecated

as of 5.2.5, in favor of setTransactionAttributes(Properties)

Create a new TransactionInterceptor.

Parameters
ptm:PlatformTransactionManager

the default transaction manager to perform the actual transaction management

attributes:Properties

the transaction attributes in properties format

Annotations
@Deprecated
See Also
setTransactionManager, setTransactionAttributes(java.util.Properties)

Method Detail

invokeback to summary
public Object invoke(MethodInvocation invocation) throws Throwable

Implements org.aopalliance.intercept.MethodInterceptor.invoke.

Doc from org.aopalliance.intercept.MethodInterceptor.invoke.

Implement this method to perform extra treatments before and after the invocation. Polite implementations would certainly like to invoke Joinpoint#proceed().

Parameters
invocation:MethodInvocation

the method invocation joinpoint

Returns:Object

the result of the call to Joinpoint#proceed(); might be intercepted by the interceptor

Annotations
@Override
@Nullable
Exceptions
Throwable:
if the interceptors or the target object throws an exception
readObjectback to summary
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException
writeObjectback to summary
private void writeObject(ObjectOutputStream oos) throws IOException