use of cn.taketoday.context.annotation.Bean in project today-infrastructure by TAKETODAY.
the class FactoryMethodComponent method protectedInstance.
@Bean
@BeanAge(1)
protected TestBean protectedInstance(@Qualifier("public") TestBean spouse, @Value("#{privateInstance.age}") String country) {
TestBean tb = new TestBean("protectedInstance", 1);
tb.setSpouse(tb);
tb.setCountry(country);
return tb;
}
use of cn.taketoday.context.annotation.Bean in project today-infrastructure by TAKETODAY.
the class ProxyCachingConfiguration method cacheInterceptor.
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public CacheInterceptor cacheInterceptor(CacheOperationSource cacheOperationSource) {
CacheInterceptor interceptor = new CacheInterceptor();
interceptor.configure(this.errorHandler, this.keyGenerator, this.cacheResolver, this.cacheManager);
interceptor.setCacheOperationSource(cacheOperationSource);
return interceptor;
}
use of cn.taketoday.context.annotation.Bean in project today-infrastructure by TAKETODAY.
the class ProxyCachingConfiguration method cacheAdvisor.
@Bean(name = CacheManagementConfigUtils.CACHE_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public BeanFactoryCacheOperationSourceAdvisor cacheAdvisor(CacheOperationSource cacheOperationSource, CacheInterceptor cacheInterceptor) {
BeanFactoryCacheOperationSourceAdvisor advisor = new BeanFactoryCacheOperationSourceAdvisor();
advisor.setCacheOperationSource(cacheOperationSource);
advisor.setAdvice(cacheInterceptor);
if (this.enableCaching != null) {
advisor.setOrder(this.enableCaching.<Integer>getNumber("order"));
}
return advisor;
}
use of cn.taketoday.context.annotation.Bean in project today-infrastructure by TAKETODAY.
the class LifecycleAutoConfiguration method defaultLifecycleProcessor.
@Bean(name = AbstractApplicationContext.LIFECYCLE_PROCESSOR_BEAN_NAME)
@ConditionalOnMissingBean(search = SearchStrategy.CURRENT, name = AbstractApplicationContext.LIFECYCLE_PROCESSOR_BEAN_NAME)
public DefaultLifecycleProcessor defaultLifecycleProcessor(LifecycleProperties properties) {
DefaultLifecycleProcessor lifecycleProcessor = new DefaultLifecycleProcessor();
lifecycleProcessor.setTimeoutPerShutdownPhase(properties.getTimeoutPerShutdownPhase().toMillis());
return lifecycleProcessor;
}
use of cn.taketoday.context.annotation.Bean in project today-infrastructure by TAKETODAY.
the class MessageSourceAutoConfiguration method messageSource.
@Bean
public MessageSource messageSource(MessageSourceProperties properties) {
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
if (StringUtils.hasText(properties.getBasename())) {
messageSource.setBasenames(StringUtils.commaDelimitedListToStringArray(StringUtils.trimAllWhitespace(properties.getBasename())));
}
if (properties.getEncoding() != null) {
messageSource.setDefaultEncoding(properties.getEncoding().name());
}
messageSource.setFallbackToSystemLocale(properties.isFallbackToSystemLocale());
Duration cacheDuration = properties.getCacheDuration();
if (cacheDuration != null) {
messageSource.setCacheMillis(cacheDuration.toMillis());
}
messageSource.setAlwaysUseMessageFormat(properties.isAlwaysUseMessageFormat());
messageSource.setUseCodeAsDefaultMessage(properties.isUseCodeAsDefaultMessage());
return messageSource;
}
Aggregations