Example usage for org.springframework.transaction.interceptor TransactionAttributeSource TransactionAttributeSource

List of usage examples for org.springframework.transaction.interceptor TransactionAttributeSource TransactionAttributeSource

Introduction

In this page you can find the example usage for org.springframework.transaction.interceptor TransactionAttributeSource TransactionAttributeSource.

Prototype

TransactionAttributeSource

Source Link

Usage

From source file:net.tirasa.blog.ilgrosso.dynamicspringtransactional.DynamicTransactionInterceptor.java

@Override
public TransactionAttributeSource getTransactionAttributeSource() {
    final TransactionAttributeSource origTxAttrSource = super.getTransactionAttributeSource();

    return new TransactionAttributeSource() {

        @Override//w w  w.j ava  2 s  . com
        public TransactionAttribute getTransactionAttribute(final Method method, final Class<?> targetClass) {
            TransactionAttribute txAttr = origTxAttrSource.getTransactionAttribute(method, targetClass);

            if (txAttr instanceof DefaultTransactionAttribute) {
                ((DefaultTransactionAttribute) txAttr).setQualifier(AuthContextUtils.getDomain());
            }

            return txAttr;
        }
    };
}