本文整理汇总了Java中org.springframework.context.annotation.Role类的典型用法代码示例。如果您正苦于以下问题:Java Role类的具体用法?Java Role怎么用?Java Role使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Role类属于org.springframework.context.annotation包,在下文中一共展示了Role类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: asyncAdvisor
import org.springframework.context.annotation.Role; //导入依赖的package包/类
@Bean(name=AnnotationConfigUtils.ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public AsyncAnnotationBeanPostProcessor asyncAdvisor() {
Assert.notNull(this.enableAsync, "@EnableAsync annotation metadata was not injected");
AsyncAnnotationBeanPostProcessor bpp = new AsyncAnnotationBeanPostProcessor();
Class<? extends Annotation> customAsyncAnnotation = enableAsync.getClass("annotation");
if (customAsyncAnnotation != AnnotationUtils.getDefaultValue(EnableAsync.class, "annotation")) {
bpp.setAsyncAnnotationType(customAsyncAnnotation);
}
if (this.executor != null) {
bpp.setExecutor(this.executor);
}
bpp.setProxyTargetClass(this.enableAsync.getBoolean("proxyTargetClass"));
bpp.setOrder(this.enableAsync.<Integer>getNumber("order"));
return bpp;
}
示例2: jetcacheAdvisor
import org.springframework.context.annotation.Role; //导入依赖的package包/类
@Bean(name = CacheAdvisor.CACHE_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public CacheAdvisor jetcacheAdvisor() {
ConcurrentHashMap configMap = new ConcurrentHashMap();
JetCacheInterceptor jetCacheInterceptor = new JetCacheInterceptor();
jetCacheInterceptor.setCacheConfigMap(configMap);
jetCacheInterceptor.setApplicationContext(applicationContext);
CacheAdvisor advisor = new CacheAdvisor();
advisor.setAdviceBeanName(CacheAdvisor.CACHE_ADVISOR_BEAN_NAME);
advisor.setAdvice(jetCacheInterceptor);
advisor.setBasePackages(this.enableMethodCache.getStringArray("basePackages"));
advisor.setCacheConfigMap(configMap);
advisor.setOrder(this.enableMethodCache.<Integer>getNumber("order"));
return advisor;
}
示例3: asyncAdvisor
import org.springframework.context.annotation.Role; //导入依赖的package包/类
@Bean(name = TaskManagementConfigUtils.ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public AsyncAnnotationBeanPostProcessor asyncAdvisor() {
Assert.notNull(this.enableAsync, "@EnableAsync annotation metadata was not injected");
AsyncAnnotationBeanPostProcessor bpp = new AsyncAnnotationBeanPostProcessor();
Class<? extends Annotation> customAsyncAnnotation = this.enableAsync.getClass("annotation");
if (customAsyncAnnotation != AnnotationUtils.getDefaultValue(EnableAsync.class, "annotation")) {
bpp.setAsyncAnnotationType(customAsyncAnnotation);
}
if (this.executor != null) {
bpp.setExecutor(this.executor);
}
if (this.exceptionHandler != null) {
bpp.setExceptionHandler(this.exceptionHandler);
}
bpp.setProxyTargetClass(this.enableAsync.getBoolean("proxyTargetClass"));
bpp.setOrder(this.enableAsync.<Integer>getNumber("order"));
return bpp;
}
示例4: cacheInterceptor
import org.springframework.context.annotation.Role; //导入依赖的package包/类
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public CacheInterceptor cacheInterceptor() {
CacheInterceptor interceptor = new CacheInterceptor();
interceptor.setCacheOperationSources(cacheOperationSource());
if (this.cacheResolver != null) {
interceptor.setCacheResolver(this.cacheResolver);
}
else if (this.cacheManager != null) {
interceptor.setCacheManager(this.cacheManager);
}
if (this.keyGenerator != null) {
interceptor.setKeyGenerator(this.keyGenerator);
}
if (this.errorHandler != null) {
interceptor.setErrorHandler(this.errorHandler);
}
return interceptor;
}
示例5: cacheOperationSource
import org.springframework.context.annotation.Role; //导入依赖的package包/类
@Bean(name = "jCacheOperationSource")
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public JCacheOperationSource cacheOperationSource() {
DefaultJCacheOperationSource source = new DefaultJCacheOperationSource();
if (this.cacheManager != null) {
source.setCacheManager(this.cacheManager);
}
if (this.keyGenerator != null) {
source.setKeyGenerator(this.keyGenerator);
}
if (this.cacheResolver != null) {
source.setCacheResolver(this.cacheResolver);
}
if (this.exceptionCacheResolver != null) {
source.setExceptionCacheResolver(this.exceptionCacheResolver);
}
return source;
}
示例6: packageTraceAdvisor
import org.springframework.context.annotation.Role; //导入依赖的package包/类
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public Advisor packageTraceAdvisor() {
ComposablePointcut resultPointcut = new ComposablePointcut();
{
List<String> basePackages = findBasePackages();
String pointcutExpression = makeExpression(basePackages);
AspectJExpressionPointcut packagePointcut = new AspectJExpressionPointcut();
log.info("Include package Pointcut expression : {}", pointcutExpression);
packagePointcut.setExpression(pointcutExpression);
resultPointcut.intersection((Pointcut) packagePointcut);
}
String excludeAnnotation = buildExcludeAnnotation();
log.info("Exclude Annotation Pointcut expression : {}", excludeAnnotation);
AspectJExpressionPointcut basePointcut = new AspectJExpressionPointcut();
basePointcut.setExpression(excludeAnnotation);
resultPointcut.intersection((Pointcut) basePointcut);
DefaultPointcutAdvisor pointcutAdvisor = new DefaultPointcutAdvisor(resultPointcut, new TraceAopInterceptor(traceLogManager));
pointcutAdvisor.setOrder(Integer.MAX_VALUE);
return pointcutAdvisor;
}
示例7: lockInterceptor
import org.springframework.context.annotation.Role; //导入依赖的package包/类
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public LockInterceptor lockInterceptor() {
LockInterceptor interceptor = new LockInterceptor();
interceptor.setLockAttributeSource(lockAttributeSource());
AbstractLockSynchronizationManager synchronizationManager;
if (enableLock.getBoolean("sessionTransacted")) {
synchronizationManager = new SessionTransactedLockSynchronizationManager();
} else {
synchronizationManager = new DefaultLockSynchronizationManager();
}
synchronizationManager.setLockService(lockService);
synchronizationManager.setLockEventPublisher(lockEventPublisher());
interceptor.setSynchronizationManager(synchronizationManager);
return interceptor;
}
示例8: threadPoolTaskExecutor
import org.springframework.context.annotation.Role; //导入依赖的package包/类
@ConditionalOnProperty(prefix = "async.executor", name = "enabled", matchIfMissing = true)
@Bean(name = DEFAULT_TASK_EXECUTOR_BEAN_NAME, destroyMethod = "shutdown")
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public ThreadPoolTaskExecutor threadPoolTaskExecutor(AsyncExecutorProperties properties) {
log.info("Creating ThreadPoolTaskExecutor 'taskExecutor' with core-size={} max-size={} queue-capacity={}",
properties.getCorePoolSize(), properties.getMaxPoolSize(), properties.getQueueCapacity());
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(properties.getCorePoolSize());
executor.setMaxPoolSize(properties.getMaxPoolSize());
executor.setQueueCapacity(properties.getQueueCapacity());
executor.setThreadNamePrefix(properties.getThreadNamePrefix());
executor.setAwaitTerminationSeconds(properties.getAwaitTerminationSeconds());
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardOldestPolicy());
executor.afterPropertiesSet();
return executor;
}
示例9: cacheInterceptor
import org.springframework.context.annotation.Role; //导入依赖的package包/类
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public CacheInterceptor cacheInterceptor() {
CacheInterceptor interceptor = new CacheInterceptor();
interceptor.setCacheOperationSources(cacheOperationSource());
if (this.cacheManager != null) {
interceptor.setCacheManager(this.cacheManager);
}
if (this.keyGenerator != null) {
interceptor.setKeyGenerator(this.keyGenerator);
}
return interceptor;
}
示例10: transactionAdvisor
import org.springframework.context.annotation.Role; //导入依赖的package包/类
@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;
}
示例11: transactionInterceptor
import org.springframework.context.annotation.Role; //导入依赖的package包/类
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public TransactionInterceptor transactionInterceptor() {
TransactionInterceptor interceptor = new TransactionInterceptor();
interceptor.setTransactionAttributeSource(transactionAttributeSource());
if (this.txManager != null) {
interceptor.setTransactionManager(this.txManager);
}
return interceptor;
}
示例12: cacheAdvisor
import org.springframework.context.annotation.Role; //导入依赖的package包/类
@Bean(name=AnnotationConfigUtils.CACHE_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public BeanFactoryCacheOperationSourceAdvisor cacheAdvisor() {
BeanFactoryCacheOperationSourceAdvisor advisor =
new BeanFactoryCacheOperationSourceAdvisor();
advisor.setCacheOperationSource(cacheOperationSource());
advisor.setAdvice(cacheInterceptor());
advisor.setOrder(this.enableCaching.<Integer>getNumber("order"));
return advisor;
}
示例13: cacheAdvisor
import org.springframework.context.annotation.Role; //导入依赖的package包/类
@Bean(name = CacheManagementConfigUtils.CACHE_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public BeanFactoryCacheOperationSourceAdvisor cacheAdvisor() {
BeanFactoryCacheOperationSourceAdvisor advisor =
new BeanFactoryCacheOperationSourceAdvisor();
advisor.setCacheOperationSource(cacheOperationSource());
advisor.setAdvice(cacheInterceptor());
advisor.setOrder(this.enableCaching.<Integer>getNumber("order"));
return advisor;
}
示例14: transactionAdvisor
import org.springframework.context.annotation.Role; //导入依赖的package包/类
@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;
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:ProxyTransactionManagementConfiguration.java
示例15: cacheAdvisor
import org.springframework.context.annotation.Role; //导入依赖的package包/类
@Bean(name = CacheManagementConfigUtils.JCACHE_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public BeanFactoryJCacheOperationSourceAdvisor cacheAdvisor() {
BeanFactoryJCacheOperationSourceAdvisor advisor =
new BeanFactoryJCacheOperationSourceAdvisor();
advisor.setCacheOperationSource(cacheOperationSource());
advisor.setAdvice(cacheInterceptor());
advisor.setOrder(this.enableCaching.<Integer>getNumber("order"));
return advisor;
}