Search in sources :

Example 1 with Role

use of cn.taketoday.context.annotation.Role in project today-infrastructure by TAKETODAY.

the class ProxyTransactionManagementConfiguration method transactionInterceptor.

@Component
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public TransactionInterceptor transactionInterceptor(TransactionAttributeSource transactionAttributeSource) {
    TransactionInterceptor interceptor = new TransactionInterceptor();
    interceptor.setTransactionAttributeSource(transactionAttributeSource);
    if (this.txManager != null) {
        interceptor.setTransactionManager(this.txManager);
    }
    return interceptor;
}
Also used : TransactionInterceptor(cn.taketoday.transaction.interceptor.TransactionInterceptor) Role(cn.taketoday.context.annotation.Role) Component(cn.taketoday.lang.Component)

Example 2 with Role

use of cn.taketoday.context.annotation.Role 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;
}
Also used : CacheInterceptor(cn.taketoday.cache.interceptor.CacheInterceptor) Role(cn.taketoday.context.annotation.Role) Bean(cn.taketoday.context.annotation.Bean)

Example 3 with Role

use of cn.taketoday.context.annotation.Role 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;
}
Also used : BeanFactoryCacheOperationSourceAdvisor(cn.taketoday.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor) Role(cn.taketoday.context.annotation.Role) Bean(cn.taketoday.context.annotation.Bean)

Example 4 with Role

use of cn.taketoday.context.annotation.Role in project today-framework by TAKETODAY.

the class ProxyJCacheConfiguration method cacheAdvisor.

@Bean(name = CacheManagementConfigUtils.JCACHE_ADVISOR_BEAN_NAME)
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public BeanFactoryJCacheOperationSourceAdvisor cacheAdvisor(JCacheOperationSource jCacheOperationSource, JCacheInterceptor jCacheInterceptor) {
    BeanFactoryJCacheOperationSourceAdvisor advisor = new BeanFactoryJCacheOperationSourceAdvisor();
    advisor.setCacheOperationSource(jCacheOperationSource);
    advisor.setAdvice(jCacheInterceptor);
    if (this.enableCaching != null) {
        advisor.setOrder(this.enableCaching.<Integer>getNumber("order"));
    }
    return advisor;
}
Also used : BeanFactoryJCacheOperationSourceAdvisor(cn.taketoday.cache.jcache.interceptor.BeanFactoryJCacheOperationSourceAdvisor) Role(cn.taketoday.context.annotation.Role) Bean(cn.taketoday.context.annotation.Bean)

Example 5 with Role

use of cn.taketoday.context.annotation.Role in project today-framework by TAKETODAY.

the class WebSessionConfig method sessionIdGenerator.

/**
 * @since 4.0
 */
@Component
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@ConditionalOnMissingBean(SessionIdGenerator.class)
SessionIdGenerator sessionIdGenerator(ServerProperties serverProperties) {
    SecureRandomSessionIdGenerator generator = new SecureRandomSessionIdGenerator();
    Session session = serverProperties.getSession();
    generator.setLength(session.getSessionIdLength());
    return generator;
}
Also used : SecureRandomSessionIdGenerator(cn.taketoday.web.session.SecureRandomSessionIdGenerator) Role(cn.taketoday.context.annotation.Role) ConditionalOnMissingBean(cn.taketoday.context.condition.ConditionalOnMissingBean) Component(cn.taketoday.lang.Component)

Aggregations

Role (cn.taketoday.context.annotation.Role)16 Bean (cn.taketoday.context.annotation.Bean)8 Component (cn.taketoday.lang.Component)8 ConditionalOnMissingBean (cn.taketoday.context.condition.ConditionalOnMissingBean)4 Advice (cn.taketoday.aop.support.annotation.Advice)3 Aspect (cn.taketoday.aop.support.annotation.Aspect)3 BeanFactoryCacheOperationSourceAdvisor (cn.taketoday.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor)2 CacheInterceptor (cn.taketoday.cache.interceptor.CacheInterceptor)2 BeanFactoryJCacheOperationSourceAdvisor (cn.taketoday.cache.jcache.interceptor.BeanFactoryJCacheOperationSourceAdvisor)2 JCacheInterceptor (cn.taketoday.cache.jcache.interceptor.JCacheInterceptor)2 BeanFactoryTransactionAttributeSourceAdvisor (cn.taketoday.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor)2 TransactionInterceptor (cn.taketoday.transaction.interceptor.TransactionInterceptor)2 CacheEvictInterceptor (cn.taketoday.cache.interceptor.CacheEvictInterceptor)1 CachePutInterceptor (cn.taketoday.cache.interceptor.CachePutInterceptor)1 CacheableInterceptor (cn.taketoday.cache.interceptor.CacheableInterceptor)1 SecureRandomSessionIdGenerator (cn.taketoday.web.session.SecureRandomSessionIdGenerator)1