Java 类org.springframework.transaction.config.TransactionManagementConfigUtils 实例源码

项目:lams    文件:TransactionManagementConfigurationSelector.java   
/**
 * {@inheritDoc}
 * @return {@link ProxyTransactionManagementConfiguration} or
 * {@code AspectJTransactionManagementConfiguration} for {@code PROXY} and
 * {@code ASPECTJ} values of {@link EnableTransactionManagement#mode()}, respectively
 */
@Override
protected String[] selectImports(AdviceMode adviceMode) {
    switch (adviceMode) {
        case PROXY:
            return new String[] {AutoProxyRegistrar.class.getName(), ProxyTransactionManagementConfiguration.class.getName()};
        case ASPECTJ:
            return new String[] {TransactionManagementConfigUtils.TRANSACTION_ASPECT_CONFIGURATION_CLASS_NAME};
        default:
            return null;
    }
}
项目:lams    文件:ProxyTransactionManagementConfiguration.java   
@Bean(name=TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public BeanFactoryTransactionAttributeSourceAdvisor transactionAdvisor() {
    BeanFactoryTransactionAttributeSourceAdvisor advisor = new BeanFactoryTransactionAttributeSourceAdvisor();
    advisor.setTransactionAttributeSource(transactionAttributeSource());
    advisor.setAdvice(transactionInterceptor());
    advisor.setOrder(this.enableTx.<Integer>getNumber("order"));
    return advisor;
}
项目:spring4-understanding    文件:TransactionManagementConfigurationSelector.java   
/**
 * {@inheritDoc}
 * @return {@link ProxyTransactionManagementConfiguration} or
 * {@code AspectJTransactionManagementConfiguration} for {@code PROXY} and
 * {@code ASPECTJ} values of {@link EnableTransactionManagement#mode()}, respectively
 */
@Override
protected String[] selectImports(AdviceMode adviceMode) {
    switch (adviceMode) {
        case PROXY:
            return new String[] {AutoProxyRegistrar.class.getName(), ProxyTransactionManagementConfiguration.class.getName()};
        case ASPECTJ:
            return new String[] {TransactionManagementConfigUtils.TRANSACTION_ASPECT_CONFIGURATION_CLASS_NAME};
        default:
            return null;
    }
}
项目:spring4-understanding    文件:ProxyTransactionManagementConfiguration.java   
@Bean(name = TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public BeanFactoryTransactionAttributeSourceAdvisor transactionAdvisor() {
    BeanFactoryTransactionAttributeSourceAdvisor advisor = new BeanFactoryTransactionAttributeSourceAdvisor();
    advisor.setTransactionAttributeSource(transactionAttributeSource());
    advisor.setAdvice(transactionInterceptor());
    advisor.setOrder(this.enableTx.<Integer>getNumber("order"));
    return advisor;
}
项目:spring4-understanding    文件:EnableTransactionManagementTests.java   
@Test
public void transactionalEventListenerRegisteredProperly() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(EnableTxConfig.class);
    assertTrue(ctx.containsBean(TransactionManagementConfigUtils.TRANSACTIONAL_EVENT_LISTENER_FACTORY_BEAN_NAME));
    assertEquals(1, ctx.getBeansOfType(TransactionalEventListenerFactory.class).size());
    ctx.close();
}
项目:spring4-understanding    文件:AspectJTransactionManagementConfiguration.java   
@Bean(name = TransactionManagementConfigUtils.TRANSACTION_ASPECT_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public AnnotationTransactionAspect transactionAspect() {
    AnnotationTransactionAspect txAspect = AnnotationTransactionAspect.aspectOf();
    if (this.txManager != null) {
        txAspect.setTransactionManager(this.txManager);
    }
    return txAspect;
}
项目:ldtm    文件:AnnotationLdtmAttributeSource.java   
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
    this.beanFactory = (ConfigurableListableBeanFactory) beanFactory;
    try{
        advisor = (BeanFactoryTransactionAttributeSourceAdvisor) this.beanFactory.getBean(TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME);
        BeanDefinition bd = this.beanFactory.getBeanDefinition(TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME);
        String adviceBeanName = (String) bd.getPropertyValues().getPropertyValue("adviceBeanName").getValue();
        this.transactionInterceptor = (TransactionInterceptor) beanFactory.getBean(adviceBeanName);

    }catch(Exception ex){
        //忽略这个异常,如果没有使用annotationDriver就将会出现的异常
    }
}
项目:class-guard    文件:TransactionManagementConfigurationSelector.java   
/**
 * {@inheritDoc}
 * @return {@link ProxyTransactionManagementConfiguration} or
 * {@code AspectJTransactionManagementConfiguration} for {@code PROXY} and
 * {@code ASPECTJ} values of {@link EnableTransactionManagement#mode()}, respectively
 */
@Override
protected String[] selectImports(AdviceMode adviceMode) {
    switch (adviceMode) {
        case PROXY:
            return new String[] {AutoProxyRegistrar.class.getName(), ProxyTransactionManagementConfiguration.class.getName()};
        case ASPECTJ:
            return new String[] {TransactionManagementConfigUtils.TRANSACTION_ASPECT_CONFIGURATION_CLASS_NAME};
        default:
            return null;
    }
}
项目:class-guard    文件:ProxyTransactionManagementConfiguration.java   
@Bean(name=TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public BeanFactoryTransactionAttributeSourceAdvisor transactionAdvisor() {
    BeanFactoryTransactionAttributeSourceAdvisor advisor = new BeanFactoryTransactionAttributeSourceAdvisor();
    advisor.setTransactionAttributeSource(transactionAttributeSource());
    advisor.setAdvice(transactionInterceptor());
    advisor.setOrder(this.enableTx.<Integer>getNumber("order"));
    return advisor;
}
项目:class-guard    文件:AspectJTransactionManagementConfiguration.java   
@Bean(name=TransactionManagementConfigUtils.TRANSACTION_ASPECT_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public AnnotationTransactionAspect transactionAspect() {
    AnnotationTransactionAspect txAspect = AnnotationTransactionAspect.aspectOf();
    if (this.txManager != null) {
        txAspect.setTransactionManager(this.txManager);
    }
    return txAspect;
}
项目:spring4-understanding    文件:AbstractTransactionManagementConfiguration.java   
@Bean(name = TransactionManagementConfigUtils.TRANSACTIONAL_EVENT_LISTENER_FACTORY_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public TransactionalEventListenerFactory transactionalEventListenerFactory() {
    return new TransactionalEventListenerFactory();
}
项目:spring4-understanding    文件:AnnotationTransactionNamespaceHandlerTests.java   
@Test
public void transactionalEventListenerRegisteredProperly() {
    assertTrue(this.context.containsBean(TransactionManagementConfigUtils
            .TRANSACTIONAL_EVENT_LISTENER_FACTORY_BEAN_NAME));
    assertEquals(1, this.context.getBeansOfType(TransactionalEventListenerFactory.class).size());
}