当前位置: 首页>>代码示例>>Java>>正文


Java AnnotationTransactionAttributeSource类代码示例

本文整理汇总了Java中org.springframework.transaction.annotation.AnnotationTransactionAttributeSource的典型用法代码示例。如果您正苦于以下问题:Java AnnotationTransactionAttributeSource类的具体用法?Java AnnotationTransactionAttributeSource怎么用?Java AnnotationTransactionAttributeSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AnnotationTransactionAttributeSource类属于org.springframework.transaction.annotation包,在下文中一共展示了AnnotationTransactionAttributeSource类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: txProxiedTokenServices

import org.springframework.transaction.annotation.AnnotationTransactionAttributeSource; //导入依赖的package包/类
private DefaultTokenServices txProxiedTokenServices(DefaultTokenServices tokenServices, DataSource dataSource) {
    AnnotationTransactionAttributeSource attrSource = new AnnotationTransactionAttributeSource();
    DataSourceTransactionManager txManager = new DataSourceTransactionManager(dataSource);
    TransactionInterceptor txInterceptor = transactionInterceptor(attrSource, txManager);
    BeanFactoryTransactionAttributeSourceAdvisor txAdvisor = transactionAdvisor(attrSource, txInterceptor);
    ClassLoader classLoader = ClassUtils.getDefaultClassLoader();

    ProxyFactory proxyFactory = new ProxyFactory(tokenServices);
    proxyFactory.addAdvice(txInterceptor);
    proxyFactory.addAdvisor(txAdvisor);
    proxyFactory.setInterfaces(
        ClassUtils.getAllInterfacesForClass(
            new SingletonTargetSource(tokenServices).getTargetClass(), classLoader));

    return (DefaultTokenServices) proxyFactory.getProxy(classLoader);
}
 
开发者ID:petrbouda,项目名称:joyrest,代码行数:17,代码来源:OAuth2Initializer.java

示例2: TLETransactionInterceptor

import org.springframework.transaction.annotation.AnnotationTransactionAttributeSource; //导入依赖的package包/类
public TLETransactionInterceptor(AnnotationTransactionAttributeSource attributes,
	Provider<TLETransactionManager> managerProvider, String factoryName, boolean system)
{
	this.attributes = attributes;
	this.factoryName = factoryName;
	this.system = system;
	this.managerProvider = managerProvider;
}
 
开发者ID:equella,项目名称:Equella,代码行数:9,代码来源:TLETransactionInterceptor.java

示例3: testDoesNotResolveTxAnnotationOnMethodFromClassImplementingAnnotatedInterface

import org.springframework.transaction.annotation.AnnotationTransactionAttributeSource; //导入依赖的package包/类
/**
 * Note: resolution does not occur. Thus we can't make a class transactional if
 * it implements a transactionally annotated interface. This behaviour could only
 * be changed in AbstractFallbackTransactionAttributeSource in Spring proper.
 */
public void testDoesNotResolveTxAnnotationOnMethodFromClassImplementingAnnotatedInterface() throws Exception {
	AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
	Method m = ImplementsAnnotatedInterface.class.getMethod("echo", Throwable.class);
	TransactionAttribute ta = atas.getTransactionAttribute(m, ImplementsAnnotatedInterface.class);
	assertNull(ta);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:12,代码来源:TransactionAspectTests.java

示例4: postProcessBeanFactory

import org.springframework.transaction.annotation.AnnotationTransactionAttributeSource; //导入依赖的package包/类
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
	String[] beanNameArray = beanFactory.getBeanDefinitionNames();
	for (int i = 0; i < beanNameArray.length; i++) {
		String beanName = beanNameArray[i];
		BeanDefinition beanDef = beanFactory.getBeanDefinition(beanName);
		String beanClassName = beanDef.getBeanClassName();

		if (org.springframework.transaction.interceptor.TransactionProxyFactoryBean.class.getName().equals(beanClassName)) {
			throw new FatalBeanException(String.format(
					"Declaring transactions by configuration is not supported yet, please use annotations to declare transactions(beanId= %s).",
					beanName));
		}

		if (org.springframework.transaction.interceptor.TransactionInterceptor.class.getName().equals(beanClassName)) {
			boolean errorExists = true;

			MutablePropertyValues mpv = beanDef.getPropertyValues();
			PropertyValue pv = mpv.getPropertyValue("transactionAttributeSource");
			Object value = pv == null ? null : pv.getValue();
			if (value != null && RuntimeBeanReference.class.isInstance(value)) {
				RuntimeBeanReference reference = (RuntimeBeanReference) value;
				BeanDefinition refBeanDef = beanFactory.getBeanDefinition(reference.getBeanName());
				String refBeanClassName = refBeanDef.getBeanClassName();
				errorExists = AnnotationTransactionAttributeSource.class.getName().equals(refBeanClassName) == false;
			}

			if (errorExists) {
				throw new FatalBeanException(String.format(
						"Declaring transactions by configuration is not supported yet, please use annotations to declare transactions(beanId= %s).",
						beanName));
			}

		}
	}
}
 
开发者ID:liuyangming,项目名称:ByteTCC,代码行数:36,代码来源:TransactionConfigPostProcessor.java

示例5: configure

import org.springframework.transaction.annotation.AnnotationTransactionAttributeSource; //导入依赖的package包/类
@Override
protected void configure() {
    // TransactionManager
    PlatformTransactionManager transactionManager = new DataSourceTransactionManager(dataSource);

    // TransactionInterceptor
    TransactionInterceptor transactionInterceptor = new TransactionInterceptor(transactionManager, new AnnotationTransactionAttributeSource(false));

    bindInterceptor(Matchers.any(), Matchers.annotatedWith(Transactional.class), transactionInterceptor);

    bind(PlatformTransactionManager.class).toInstance(transactionManager);
}
 
开发者ID:onBass-naga,项目名称:play-guice-mirage-java-example,代码行数:13,代码来源:Global.java

示例6: transactionAdvisor

import org.springframework.transaction.annotation.AnnotationTransactionAttributeSource; //导入依赖的package包/类
private BeanFactoryTransactionAttributeSourceAdvisor transactionAdvisor(
    AnnotationTransactionAttributeSource source, TransactionInterceptor interceptor) {
    BeanFactoryTransactionAttributeSourceAdvisor advisor = new BeanFactoryTransactionAttributeSourceAdvisor();
    advisor.setTransactionAttributeSource(source);
    advisor.setAdvice(interceptor);
    return advisor;
}
 
开发者ID:petrbouda,项目名称:joyrest,代码行数:8,代码来源:OAuth2Initializer.java

示例7: transactionInterceptor

import org.springframework.transaction.annotation.AnnotationTransactionAttributeSource; //导入依赖的package包/类
private TransactionInterceptor transactionInterceptor(
    AnnotationTransactionAttributeSource source, PlatformTransactionManager txManager) {
    TransactionInterceptor interceptor = new TransactionInterceptor();
    interceptor.setTransactionAttributeSource(source);
    interceptor.setTransactionManager(txManager);
    return interceptor;
}
 
开发者ID:petrbouda,项目名称:joyrest,代码行数:8,代码来源:OAuth2Initializer.java

示例8: configure

import org.springframework.transaction.annotation.AnnotationTransactionAttributeSource; //导入依赖的package包/类
@Override
protected void configure() {
    // TransactionManager
    bind(PlatformTransactionManager.class).toProvider(getPlatformTransactionManagerType()).in(Singleton.class);

    // TransactionInterceptor
    final TransactionInterceptor transactionInterceptor = new TransactionInterceptorEx(getProvider(PlatformTransactionManager.class), new AnnotationTransactionAttributeSource(false));
    bindInterceptor(Matchers.any(), Matchers.annotatedWith(Transactional.class), transactionInterceptor);
}
 
开发者ID:XenonAbe,项目名称:dbflute-play-guice-java-example,代码行数:10,代码来源:TransactionModule.java

示例9: transactionInterceptorRealm

import org.springframework.transaction.annotation.AnnotationTransactionAttributeSource; //导入依赖的package包/类
@Bean
public TransactionInterceptor transactionInterceptorRealm() {

    return new TransactionInterceptor(transactionManagerRealm(),
            new AnnotationTransactionAttributeSource());
}
 
开发者ID:JMaNGOS,项目名称:JMaNGOS,代码行数:7,代码来源:RealmModule.java

示例10: transactionInterceptorWorld

import org.springframework.transaction.annotation.AnnotationTransactionAttributeSource; //导入依赖的package包/类
@Bean
public TransactionInterceptor transactionInterceptorWorld() {

    return new TransactionInterceptor(transactionManagerWorld(),
            new AnnotationTransactionAttributeSource());
}
 
开发者ID:JMaNGOS,项目名称:JMaNGOS,代码行数:7,代码来源:WorldModule.java

示例11: transactionInterceptorAuth

import org.springframework.transaction.annotation.AnnotationTransactionAttributeSource; //导入依赖的package包/类
@Bean
public TransactionInterceptor transactionInterceptorAuth() {

    return new TransactionInterceptor(transactionManagerAuth(),
            new AnnotationTransactionAttributeSource());
}
 
开发者ID:JMaNGOS,项目名称:JMaNGOS,代码行数:7,代码来源:AuthModule.java

示例12: testDoesNotResolveTxAnnotationOnMethodFromClassImplementingAnnotatedInterface

import org.springframework.transaction.annotation.AnnotationTransactionAttributeSource; //导入依赖的package包/类
/**
 * Note: resolution does not occur. Thus we can't make a class transactional if
 * it implements a transactionally annotated interface. This behaviour could only
 * be changed in AbstractFallbackTransactionAttributeSource in Spring proper.
 * @throws SecurityException
 * @throws NoSuchMethodException
 */
public void testDoesNotResolveTxAnnotationOnMethodFromClassImplementingAnnotatedInterface() throws SecurityException, NoSuchMethodException {
	AnnotationTransactionAttributeSource atas = new AnnotationTransactionAttributeSource();
	Method m = ImplementsAnnotatedInterface.class.getMethod("echo", Throwable.class);
	TransactionAttribute ta = atas.getTransactionAttribute(m, ImplementsAnnotatedInterface.class);
	assertNull(ta);
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:14,代码来源:TransactionAspectTests.java

示例13: setAnnotationTransactionAttributeSource

import org.springframework.transaction.annotation.AnnotationTransactionAttributeSource; //导入依赖的package包/类
/**
 * Sets the annotationTransactionAttributeSource attribute value.
 *
 * @param annotationTransactionAttributeSource The annotationTransactionAttributeSource to set.
 */
public void setAnnotationTransactionAttributeSource(AnnotationTransactionAttributeSource annotationTransactionAttributeSource) {
    this.annotationTransactionAttributeSource = annotationTransactionAttributeSource;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:9,代码来源:AnnotationAndNameMatchingTransactionAttributeSource.java


注:本文中的org.springframework.transaction.annotation.AnnotationTransactionAttributeSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。