本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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));
}
}
}
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例9: transactionInterceptorRealm
import org.springframework.transaction.annotation.AnnotationTransactionAttributeSource; //导入依赖的package包/类
@Bean
public TransactionInterceptor transactionInterceptorRealm() {
return new TransactionInterceptor(transactionManagerRealm(),
new AnnotationTransactionAttributeSource());
}
示例10: transactionInterceptorWorld
import org.springframework.transaction.annotation.AnnotationTransactionAttributeSource; //导入依赖的package包/类
@Bean
public TransactionInterceptor transactionInterceptorWorld() {
return new TransactionInterceptor(transactionManagerWorld(),
new AnnotationTransactionAttributeSource());
}
示例11: transactionInterceptorAuth
import org.springframework.transaction.annotation.AnnotationTransactionAttributeSource; //导入依赖的package包/类
@Bean
public TransactionInterceptor transactionInterceptorAuth() {
return new TransactionInterceptor(transactionManagerAuth(),
new AnnotationTransactionAttributeSource());
}
示例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);
}
示例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;
}