Search in sources :

Example 1 with BeanFactoryCacheOperationSourceAdvisor

use of org.springframework.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor in project spring-framework by spring-projects.

the class ProxyCachingConfiguration method cacheAdvisor.

@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;
}
Also used : BeanFactoryCacheOperationSourceAdvisor(org.springframework.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor) Role(org.springframework.context.annotation.Role) Bean(org.springframework.context.annotation.Bean)

Example 2 with BeanFactoryCacheOperationSourceAdvisor

use of org.springframework.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor in project spring-framework by spring-projects.

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(org.springframework.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor) Role(org.springframework.context.annotation.Role) Bean(org.springframework.context.annotation.Bean)

Example 3 with BeanFactoryCacheOperationSourceAdvisor

use of org.springframework.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor in project spring-framework by spring-projects.

the class EnableCachingIntegrationTests method assertCacheProxying.

private void assertCacheProxying(AnnotationConfigApplicationContext ctx) {
    FooRepository repo = ctx.getBean(FooRepository.class);
    boolean isCacheProxy = false;
    if (AopUtils.isAopProxy(repo)) {
        for (Advisor advisor : ((Advised) repo).getAdvisors()) {
            if (advisor instanceof BeanFactoryCacheOperationSourceAdvisor) {
                isCacheProxy = true;
                break;
            }
        }
    }
    assertTrue("FooRepository is not a cache proxy", isCacheProxy);
}
Also used : Advised(org.springframework.aop.framework.Advised) BeanFactoryCacheOperationSourceAdvisor(org.springframework.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor) Advisor(org.springframework.aop.Advisor) BeanFactoryCacheOperationSourceAdvisor(org.springframework.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor)

Example 4 with BeanFactoryCacheOperationSourceAdvisor

use of org.springframework.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor in project warn-report by saaavsaaa.

the class CachingDBConfiguration method cacheAdvisor.

@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;
}
Also used : BeanFactoryCacheOperationSourceAdvisor(org.springframework.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor) Role(org.springframework.context.annotation.Role) Bean(org.springframework.context.annotation.Bean)

Example 5 with BeanFactoryCacheOperationSourceAdvisor

use of org.springframework.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor in project warn-report by saaavsaaa.

the class CachingDBConfiguration method cacheAdvisor.

@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;
}
Also used : BeanFactoryCacheOperationSourceAdvisor(org.springframework.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor) Role(org.springframework.context.annotation.Role) Bean(org.springframework.context.annotation.Bean)

Aggregations

BeanFactoryCacheOperationSourceAdvisor (org.springframework.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor)5 Bean (org.springframework.context.annotation.Bean)4 Role (org.springframework.context.annotation.Role)4 Advisor (org.springframework.aop.Advisor)1 Advised (org.springframework.aop.framework.Advised)1