當前位置: 首頁>>代碼示例>>Java>>正文


Java Role類代碼示例

本文整理匯總了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;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:ProxyAsyncConfiguration.java

示例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;
}
 
開發者ID:alibaba,項目名稱:jetcache,代碼行數:18,代碼來源:JetCacheProxyConfiguration.java

示例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;
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:20,代碼來源:ProxyAsyncConfiguration.java

示例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;
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:20,代碼來源:ProxyCachingConfiguration.java

示例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;
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:19,代碼來源:AbstractJCacheConfiguration.java

示例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;
}
 
開發者ID:acupple,項目名稱:stormv-spring-tracer,代碼行數:25,代碼來源:SimpleTraceConfiguration.java

示例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;
}
 
開發者ID:My-easy-Solutions,項目名稱:spring-lock,代碼行數:19,代碼來源:ProxyLockConfiguration.java

示例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;
}
 
開發者ID:zalando-stups,項目名稱:booties,代碼行數:21,代碼來源:AsyncExecutorConfiguration.java

示例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;
}
 
開發者ID:deathspeeder,項目名稱:class-guard,代碼行數:14,代碼來源:ProxyCachingConfiguration.java

示例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;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:ProxyTransactionManagementConfiguration.java

示例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;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:11,代碼來源:ProxyTransactionManagementConfiguration.java

示例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;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:11,代碼來源:ProxyCachingConfiguration.java

示例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;
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:11,代碼來源:ProxyCachingConfiguration.java

示例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;
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:11,代碼來源:ProxyJCacheConfiguration.java


注:本文中的org.springframework.context.annotation.Role類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。