类 TransactionInterceptor
- java.lang.Object
- org.springframework.transaction.interceptor.TransactionAspectSupport
- org.springframework.transaction.interceptor.TransactionInterceptor
- 所有已实现的接口:
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 asTransactionAspectSupport.invokeWithinTransaction(java.lang.reflect.Method, java.lang.Class<?>, org.springframework.transaction.interceptor.TransactionAspectSupport.InvocationCallback)
in the correct order.TransactionInterceptors are thread-safe.
- 作者:
- Rod Johnson, Juergen Hoeller
- 另请参阅:
TransactionProxyFactoryBean
,ProxyFactoryBean
,ProxyFactory
, 序列化表格
嵌套类概要
从类继承的嵌套类/接口 org.springframework.transaction.interceptor.TransactionAspectSupport
TransactionAspectSupport.InvocationCallback, TransactionAspectSupport.TransactionInfo
字段概要
从类继承的字段 org.springframework.transaction.interceptor.TransactionAspectSupport
logger
构造器概要
构造器 构造器 说明 TransactionInterceptor()
Create a new TransactionInterceptor.TransactionInterceptor(PlatformTransactionManager ptm, Properties attributes)
已过时。as of 5.2.5, in favor ofTransactionAspectSupport.setTransactionAttributes(Properties)
TransactionInterceptor(PlatformTransactionManager ptm, TransactionAttributeSource tas)
已过时。as of 5.2.5, in favor ofTransactionInterceptor(TransactionManager, TransactionAttributeSource)
TransactionInterceptor(TransactionManager ptm, TransactionAttributeSource tas)
Create a new TransactionInterceptor.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 Object
invoke(MethodInvocation invocation)
Implement this method to perform extra treatments before and after the invocation.从类继承的方法 org.springframework.transaction.interceptor.TransactionAspectSupport
afterPropertiesSet, cleanupTransactionInfo, clearTransactionManagerCache, commitTransactionAfterReturning, completeTransactionAfterThrowing, createTransactionIfNecessary, currentTransactionInfo, currentTransactionStatus, determineTransactionManager, getBeanFactory, getTransactionAttributeSource, getTransactionManager, getTransactionManagerBeanName, invokeWithinTransaction, methodIdentification, prepareTransactionInfo, setBeanFactory, setTransactionAttributes, setTransactionAttributeSource, setTransactionAttributeSources, setTransactionManager, setTransactionManagerBeanName
构造器详细资料
TransactionInterceptor
public TransactionInterceptor()
Create a new TransactionInterceptor.Transaction manager and transaction attributes still need to be set.
TransactionInterceptor
public TransactionInterceptor(TransactionManager ptm, TransactionAttributeSource tas)
Create a new TransactionInterceptor.- 参数:
ptm
- the default transaction manager to perform the actual transaction managementtas
- the attribute source to be used to find transaction attributes- 从以下版本开始:
- 5.2.5
- 另请参阅:
TransactionAspectSupport.setTransactionManager(org.springframework.transaction.TransactionManager)
,TransactionAspectSupport.setTransactionAttributeSource(org.springframework.transaction.interceptor.TransactionAttributeSource)
TransactionInterceptor
@Deprecated public TransactionInterceptor(PlatformTransactionManager ptm, TransactionAttributeSource tas)
已过时。as of 5.2.5, in favor ofTransactionInterceptor(TransactionManager, TransactionAttributeSource)
Create a new TransactionInterceptor.- 参数:
ptm
- the default transaction manager to perform the actual transaction managementtas
- the attribute source to be used to find transaction attributes- 另请参阅:
TransactionAspectSupport.setTransactionManager(org.springframework.transaction.TransactionManager)
,TransactionAspectSupport.setTransactionAttributeSource(org.springframework.transaction.interceptor.TransactionAttributeSource)
TransactionInterceptor
@Deprecated public TransactionInterceptor(PlatformTransactionManager ptm, Properties attributes)
已过时。as of 5.2.5, in favor ofTransactionAspectSupport.setTransactionAttributes(Properties)
Create a new TransactionInterceptor.- 参数:
ptm
- the default transaction manager to perform the actual transaction managementattributes
- the transaction attributes in properties format- 另请参阅:
TransactionAspectSupport.setTransactionManager(org.springframework.transaction.TransactionManager)
,TransactionAspectSupport.setTransactionAttributes(java.util.Properties)
方法详细资料
invoke
@Nullable public Object invoke(MethodInvocation invocation) throws Throwable
从接口复制的说明:MethodInterceptor
Implement this method to perform extra treatments before and after the invocation. Polite implementations would certainly like to invokeJoinpoint.proceed()
.- 指定者:
invoke
在接口中MethodInterceptor
- 参数:
invocation
- the method invocation joinpoint- 返回:
- the result of the call to
Joinpoint.proceed()
; might be intercepted by the interceptor - 抛出:
Throwable
- if the interceptors or the target object throws an exception