org.springframework.context.annotation.Role Java Examples

The following examples show how to use org.springframework.context.annotation.Role. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProxyAsyncConfiguration.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #2
Source File: ProxyAsyncConfiguration.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example #3
Source File: ProxyLimiterConfiguration.java    From Limiter with Apache License 2.0 6 votes vote down vote up
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public LimitedResourceSource limitedResourceSource() {
    String[] parsersClassNames = this.enableLimiter.getStringArray("annotationParser");
    List<String> defaultParsers = findDefaultParsers();
    if (!CollectionUtils.isEmpty(defaultParsers)) {
        int len = parsersClassNames.length;
        parsersClassNames = Arrays.copyOf(parsersClassNames, parsersClassNames.length + defaultParsers.size());
        for (int i = 0; i < defaultParsers.size(); i++) {
            parsersClassNames[i + len] = defaultParsers.get(i);
        }
    }
    LimiterAnnotationParser[] parsers = new LimiterAnnotationParser[parsersClassNames.length];
    for (int i = 0; i < parsersClassNames.length; i++) {
        try {
            Class<LimiterAnnotationParser> parserClass = (Class<LimiterAnnotationParser>) Class.forName(parsersClassNames[i]);
            parsers[i] = parserClass.newInstance();
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
            e.printStackTrace();
            throw new RuntimeException("Class Not Found!");
        }
    }
    return new DefaultLimitedResourceSource(parsers);
}
 
Example #4
Source File: ProxyCachingConfiguration.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example #5
Source File: AbstractJCacheConfiguration.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@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;
}
 
Example #6
Source File: ProxyCachingConfiguration.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #7
Source File: AbstractJCacheConfiguration.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #8
Source File: ProxyJCacheConfiguration.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Bean(name = CacheManagementConfigUtils.JCACHE_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public BeanFactoryJCacheOperationSourceAdvisor cacheAdvisor() {
	BeanFactoryJCacheOperationSourceAdvisor advisor =
			new BeanFactoryJCacheOperationSourceAdvisor();
	advisor.setCacheOperationSource(cacheOperationSource());
	advisor.setAdvice(cacheInterceptor());
	if (this.enableCaching != null) {
		advisor.setOrder(this.enableCaching.<Integer>getNumber("order"));
	}
	return advisor;
}
 
Example #9
Source File: ProxyTransactionManagementConfiguration.java    From java-technology-stack with MIT License 5 votes vote down vote up
@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;
}
 
Example #10
Source File: AspectJAsyncConfiguration.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Bean(name = TaskManagementConfigUtils.ASYNC_EXECUTION_ASPECT_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public AnnotationAsyncExecutionAspect asyncAdvisor() {
	AnnotationAsyncExecutionAspect asyncAspect = AnnotationAsyncExecutionAspect.aspectOf();
	asyncAspect.configure(this.executor, this.exceptionHandler);
	return asyncAspect;
}
 
Example #11
Source File: ProxyCachingConfiguration.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example #12
Source File: AspectJJtaTransactionManagementConfiguration.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Bean(name = TransactionManagementConfigUtils.JTA_TRANSACTION_ASPECT_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public JtaAnnotationTransactionAspect jtaTransactionAspect() {
	JtaAnnotationTransactionAspect txAspect = JtaAnnotationTransactionAspect.aspectOf();
	if (this.txManager != null) {
		txAspect.setTransactionManager(this.txManager);
	}
	return txAspect;
}
 
Example #13
Source File: SpringBootActuatorEndpointsBootstrap.java    From thinking-in-spring-boot-samples with Apache License 2.0 5 votes vote down vote up
/**
 * 由于当前工程依赖 org.springframework.security:spring-security-web 的缘故,
 * BASIC 验证需要显示地关闭
 *
 * @param http {@link ServerHttpSecurity}
 * @return {@link SecurityWebFilterChain}
 */
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {
    return http.securityMatcher(EndpointRequest.toAnyEndpoint())
            .httpBasic().disable() // 关闭 BASIC 验证
            .build();
}
 
Example #14
Source File: ProxyLimiterConfiguration.java    From Limiter with Apache License 2.0 5 votes vote down vote up
@Bean(name = "site.higgs.limiter.config.internalLimiterAdvisor")
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public BeanFactoryLimitedResourceSourceAdvisor limiterAdvisor() {
    BeanFactoryLimitedResourceSourceAdvisor advisor =
            new BeanFactoryLimitedResourceSourceAdvisor(limitedResourceSource());
    advisor.setAdvice(limiterInterceptor());
    if (this.enableLimiter != null) {
        advisor.setOrder(this.enableLimiter.<Integer>getNumber("order"));
    }
    return advisor;
}
 
Example #15
Source File: ProxyTransactionManagementConfiguration.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Bean(name = TransactionManagementConfigUtils.TRANSACTION_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public BeanFactoryTransactionAttributeSourceAdvisor transactionAdvisor() {
	BeanFactoryTransactionAttributeSourceAdvisor advisor = new BeanFactoryTransactionAttributeSourceAdvisor();
	advisor.setTransactionAttributeSource(transactionAttributeSource());
	advisor.setAdvice(transactionInterceptor());
	if (this.enableTx != null) {
		advisor.setOrder(this.enableTx.<Integer>getNumber("order"));
	}
	return advisor;
}
 
Example #16
Source File: ProxyCachingConfiguration.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public CacheInterceptor cacheInterceptor() {
	CacheInterceptor interceptor = new CacheInterceptor();
	interceptor.configure(this.errorHandler, this.keyGenerator, this.cacheResolver, this.cacheManager);
	interceptor.setCacheOperationSource(cacheOperationSource());
	return interceptor;
}
 
Example #17
Source File: ProxyLimiterConfiguration.java    From Limiter with Apache License 2.0 5 votes vote down vote up
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public LimiterInterceptor limiterInterceptor() {
    LimiterInterceptor interceptor = new LimiterInterceptor();
    interceptor.setLimitedResourceSource(limitedResourceSource());
    return interceptor;
}
 
Example #18
Source File: AspectJAsyncConfiguration.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Bean(name = TaskManagementConfigUtils.ASYNC_EXECUTION_ASPECT_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public AnnotationAsyncExecutionAspect asyncAdvisor() {
	AnnotationAsyncExecutionAspect asyncAspect = AnnotationAsyncExecutionAspect.aspectOf();
	asyncAspect.configure(this.executor, this.exceptionHandler);
	return asyncAspect;
}
 
Example #19
Source File: ProxyTransactionManagementConfiguration.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example #20
Source File: ProxyTransactionManagementConfiguration.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example #21
Source File: AspectJTransactionManagementConfiguration.java    From java-technology-stack with MIT License 5 votes vote down vote up
@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;
}
 
Example #22
Source File: ProxyJCacheConfiguration.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example #23
Source File: ProxyJCacheConfiguration.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Bean(name = "jCacheInterceptor")
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public JCacheInterceptor cacheInterceptor() {
	JCacheInterceptor interceptor = new JCacheInterceptor();
	interceptor.setCacheOperationSource(cacheOperationSource());
	if (this.errorHandler != null) {
		interceptor.setErrorHandler(this.errorHandler);
	}
	return interceptor;
}
 
Example #24
Source File: JetCacheProxyConfiguration.java    From jetcache with Apache License 2.0 5 votes vote down vote up
@Bean(name = CacheAdvisor.CACHE_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public CacheAdvisor jetcacheAdvisor(JetCacheInterceptor jetCacheInterceptor) {
    CacheAdvisor advisor = new CacheAdvisor();
    advisor.setAdviceBeanName(CacheAdvisor.CACHE_ADVISOR_BEAN_NAME);
    advisor.setAdvice(jetCacheInterceptor);
    advisor.setBasePackages(this.enableMethodCache.getStringArray("basePackages"));
    advisor.setOrder(this.enableMethodCache.<Integer>getNumber("order"));
    return advisor;
}
 
Example #25
Source File: ProxyCachingConfiguration.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #26
Source File: ProxyTransactionManagementConfiguration.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #27
Source File: ProxyTransactionManagementConfiguration.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #28
Source File: ProxyJCacheConfiguration.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #29
Source File: ProxyJCacheConfiguration.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Bean(name = "jCacheInterceptor")
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public JCacheInterceptor cacheInterceptor() {
	JCacheInterceptor interceptor = new JCacheInterceptor();
	interceptor.setCacheOperationSource(cacheOperationSource());
	if (this.errorHandler != null) {
		interceptor.setErrorHandler(this.errorHandler);
	}
	return interceptor;
}
 
Example #30
Source File: AspectJTransactionManagementConfiguration.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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;
}