Class TransactionalInterceptor
java.lang.Object
io.micronaut.transaction.interceptor.TransactionalInterceptor
- All Implemented Interfaces:
io.micronaut.aop.Interceptor<Object,
,Object> io.micronaut.aop.MethodInterceptor<Object,
,Object> io.micronaut.core.order.Ordered
@Singleton
@Internal
public final class TransactionalInterceptor
extends Object
implements io.micronaut.aop.MethodInterceptor<Object,Object>
Default implementation of
TransactionalAdvice
. Forked from the reflection based code in Spring.- Since:
- 1.0
- Author:
- graemerocher, Denis stepanov
-
Field Summary
Fields inherited from interface io.micronaut.aop.Interceptor
ARGUMENT, CACHEABLE_LAZY_TARGET, HOTSWAP, LAZY, PROXY_TARGET
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorsConstructorDescriptionTransactionalInterceptor
(TransactionOperationsRegistry transactionOperationsRegistry, TransactionDataSourceTenantResolver tenantResolver, io.micronaut.core.convert.ConversionService conversionService) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TransactionStatus<T>
Return the transaction status of the current method invocation.int
getOrder()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.aop.MethodInterceptor
intercept
-
Constructor Details
-
TransactionalInterceptor
public TransactionalInterceptor(@NonNull TransactionOperationsRegistry transactionOperationsRegistry, @Nullable TransactionDataSourceTenantResolver tenantResolver, io.micronaut.core.convert.ConversionService conversionService) Default constructor.- Parameters:
transactionOperationsRegistry
- TheTransactionOperationsRegistry
tenantResolver
- TheTransactionDataSourceTenantResolver
conversionService
-
-
-
Method Details
-
getOrder
public int getOrder()- Specified by:
getOrder
in interfaceio.micronaut.core.order.Ordered
-
intercept
-
currentTransactionStatus
Return the transaction status of the current method invocation. Mainly intended for code that wants to set the current transaction rollback-only but not throw an application exception.- Type Parameters:
T
- The connection type- Returns:
- The current status
- Throws:
NoTransactionException
- if the transaction info cannot be found, because the method was invoked outside an AOP invocation context
-