Java Code Examples for org.springframework.beans.factory.config.BeanDefinition#ROLE_INFRASTRUCTURE

The following examples show how to use org.springframework.beans.factory.config.BeanDefinition#ROLE_INFRASTRUCTURE . 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: 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 2
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 3
Source File: OpenTracingJdbcAutoConfiguration.java    From opentracing-toolbox with MIT License 5 votes vote down vote up
@API(status = INTERNAL)
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@ConditionalOnProperty(name = "opentracing.jdbc.enabled", havingValue = "true", matchIfMissing = true)
public static BeanPostProcessor tracingDataSourceBeanPostProcessor(final BeanFactory beanFactory) {
    return new TracingProcessor(beanFactory);
}
 
Example 4
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 5
Source File: MBeanExportConfiguration.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Bean(name = MBEAN_EXPORTER_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public AnnotationMBeanExporter mbeanExporter() {
	AnnotationMBeanExporter exporter = new AnnotationMBeanExporter();
	setupDomain(exporter);
	setupServer(exporter);
	setupRegistrationPolicy(exporter);
	return exporter;
}
 
Example 6
Source File: ProxyAsyncConfiguration.java    From java-technology-stack with MIT License 5 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();
	bpp.configure(this.executor, this.exceptionHandler);
	Class<? extends Annotation> customAsyncAnnotation = this.enableAsync.getClass("annotation");
	if (customAsyncAnnotation != AnnotationUtils.getDefaultValue(EnableAsync.class, "annotation")) {
		bpp.setAsyncAnnotationType(customAsyncAnnotation);
	}
	bpp.setProxyTargetClass(this.enableAsync.getBoolean("proxyTargetClass"));
	bpp.setOrder(this.enableAsync.<Integer>getNumber("order"));
	return bpp;
}
 
Example 7
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 8
Source File: MBeanExportConfiguration.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Bean(name = MBEAN_EXPORTER_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public AnnotationMBeanExporter mbeanExporter() {
	AnnotationMBeanExporter exporter = new AnnotationMBeanExporter();
	Assert.state(this.enableMBeanExport != null, "No EnableMBeanExport annotation found");
	setupDomain(exporter, this.enableMBeanExport);
	setupServer(exporter, this.enableMBeanExport);
	setupRegistrationPolicy(exporter, this.enableMBeanExport);
	return exporter;
}
 
Example 9
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 10
Source File: ProxyTransactionManagementConfiguration.java    From spring-analysis-note 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 11
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 12
Source File: RoleAndDescriptionAnnotationTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Description("A Bean method with a role")
public String bar() {
	return "bar";
}
 
Example 13
Source File: InfrastructureAdvisorAutoProxyCreator.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
protected boolean isEligibleAdvisorBean(String beanName) {
	return (this.beanFactory != null && this.beanFactory.containsBeanDefinition(beanName) &&
			this.beanFactory.getBeanDefinition(beanName).getRole() == BeanDefinition.ROLE_INFRASTRUCTURE);
}
 
Example 14
Source File: SpringConfiguredConfiguration.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Bean(name = BEAN_CONFIGURER_ASPECT_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public AnnotationBeanConfigurerAspect beanConfigurerAspect() {
	return AnnotationBeanConfigurerAspect.aspectOf();
}
 
Example 15
Source File: AbstractTransactionManagementConfiguration.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Bean(name = TransactionManagementConfigUtils.TRANSACTIONAL_EVENT_LISTENER_FACTORY_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public TransactionalEventListenerFactory transactionalEventListenerFactory() {
	return new TransactionalEventListenerFactory();
}
 
Example 16
Source File: SleuthAnnotationAutoConfiguration.java    From spring-cloud-sleuth with Apache License 2.0 4 votes vote down vote up
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@ConditionalOnClass(name = "reactor.core.publisher.Flux")
SleuthMethodInvocationProcessor reactorSleuthMethodInvocationProcessor() {
	return new ReactorSleuthMethodInvocationProcessor();
}
 
Example 17
Source File: ProxyCachingConfiguration.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public CacheOperationSource cacheOperationSource() {
	return new AnnotationCacheOperationSource();
}
 
Example 18
Source File: SampleTransactionManagementConfiguration.java    From spring-boot-graal-feature with Apache License 2.0 4 votes vote down vote up
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public TransactionAttributeSource transactionAttributeSource() {
	return new AnnotationTransactionAttributeSource();
}
 
Example 19
Source File: AbstractTransactionManagementConfiguration.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Bean(name = TransactionManagementConfigUtils.TRANSACTIONAL_EVENT_LISTENER_FACTORY_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public static TransactionalEventListenerFactory transactionalEventListenerFactory() {
	return new TransactionalEventListenerFactory();
}
 
Example 20
Source File: SampleTransactionManagementConfiguration.java    From spring-boot-graal-feature with Apache License 2.0 4 votes vote down vote up
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public TransactionAttributeSource transactionAttributeSource() {
	return new AnnotationTransactionAttributeSource();
}