package com.brilliance.isc.common.transaction;

import com.brilliance.isc.common.context.SpringEnvContext;
import com.brilliance.isc.common.exception.CommonServiceException;
import org.springframework.stereotype.Component;

@Component
public class TransactionServiceFactory {

    public TransactionService getTransactionService(String transName) {
        TransactionService transactionService = SpringEnvContext.getBean(transName + ".transaction");
        if (transactionService == null) {
            throw new CommonServiceException("transactionService [" + transName + "] unknown");
        }
        return transactionService;
    }

}
