Spring Framework

org.springframework.transaction.interceptor
Class TransactionInterceptor

java.lang.Object
  extended by org.springframework.transaction.interceptor.TransactionAspectSupport
      extended by org.springframework.transaction.interceptor.TransactionInterceptor
All Implemented Interfaces:
java.io.Serializable, org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor, Aware, BeanFactoryAware, InitializingBean

public class TransactionInterceptor
extends TransactionAspectSupport
implements org.aopalliance.intercept.MethodInterceptor, java.io.Serializable

AOP Alliance MethodInterceptor for declarative transaction management using the common Spring transaction infrastructure (PlatformTransactionManager).

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.createTransactionIfNecessary(java.lang.reflect.Method, java.lang.Class) in the correct order.

TransactionInterceptors are thread-safe.

Author:
Rod Johnson, Juergen Hoeller
See Also:
TransactionProxyFactoryBean, ProxyFactoryBean, ProxyFactory, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.springframework.transaction.interceptor.TransactionAspectSupport
TransactionAspectSupport.TransactionInfo
 
Field Summary
 
Fields inherited from class org.springframework.transaction.interceptor.TransactionAspectSupport
logger
 
Constructor Summary
TransactionInterceptor()
          Create a new TransactionInterceptor.
TransactionInterceptor(PlatformTransactionManager ptm, java.util.Properties attributes)
          Create a new TransactionInterceptor.
TransactionInterceptor(PlatformTransactionManager ptm, TransactionAttributeSource tas)
          Create a new TransactionInterceptor.
 
Method Summary
 java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation)
           
 
Methods inherited from class org.springframework.transaction.interceptor.TransactionAspectSupport
afterPropertiesSet, cleanupTransactionInfo, commitTransactionAfterReturning, completeTransactionAfterThrowing, createTransactionIfNecessary, createTransactionIfNecessary, currentTransactionInfo, currentTransactionStatus, determineTransactionManager, getBeanFactory, getTransactionAttributeSource, getTransactionManager, getTransactionManagerBeanName, methodIdentification, methodIdentification, prepareTransactionInfo, setBeanFactory, setTransactionAttributes, setTransactionAttributeSource, setTransactionAttributeSources, setTransactionManager, setTransactionManagerBeanName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionInterceptor

public TransactionInterceptor()
Create a new TransactionInterceptor.

Transaction manager and transaction attributes still need to be set.

See Also:
TransactionAspectSupport.setTransactionManager(org.springframework.transaction.PlatformTransactionManager), TransactionAspectSupport.setTransactionAttributes(java.util.Properties), TransactionAspectSupport.setTransactionAttributeSource(TransactionAttributeSource)

TransactionInterceptor

public TransactionInterceptor(PlatformTransactionManager ptm,
                              java.util.Properties attributes)
Create a new TransactionInterceptor.

Parameters:
ptm - the transaction manager to perform the actual transaction management
attributes - the transaction attributes in properties format
See Also:
TransactionAspectSupport.setTransactionManager(org.springframework.transaction.PlatformTransactionManager), TransactionAspectSupport.setTransactionAttributes(java.util.Properties)

TransactionInterceptor

public TransactionInterceptor(PlatformTransactionManager ptm,
                              TransactionAttributeSource tas)
Create a new TransactionInterceptor.

Parameters:
ptm - the transaction manager to perform the actual transaction management
tas - the attribute source to be used to find transaction attributes
See Also:
TransactionAspectSupport.setTransactionManager(org.springframework.transaction.PlatformTransactionManager), TransactionAspectSupport.setTransactionAttributeSource(TransactionAttributeSource)
Method Detail

invoke

public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation)
                        throws java.lang.Throwable
Specified by:
invoke in interface org.aopalliance.intercept.MethodInterceptor
Throws:
java.lang.Throwable

Spring Framework