Package org.springframework.cache.interceptor

Examples of org.springframework.cache.interceptor.CacheInterceptor


    assertSame(ctx.getBean("keyGenerator", KeyGenerator.class), ci.getKeyGenerator());
  }

  @Test
  public void testCacheErrorHandler() {
    CacheInterceptor ci = ctx.getBean(CacheInterceptor.class);
    assertSame(ctx.getBean("errorHandler", CacheErrorHandler.class), ci.getErrorHandler());
  }
View Full Code Here


  @Test
  public void emptyConfigSupport() {
    ConfigurableApplicationContext context =
        new AnnotationConfigApplicationContext(EmptyConfigSupportConfig.class);

    CacheInterceptor ci = context.getBean(CacheInterceptor.class);
    assertNotNull(ci.getCacheResolver());
    assertEquals(SimpleCacheResolver.class, ci.getCacheResolver().getClass());
    assertSame(context.getBean(CacheManager.class),
        ((SimpleCacheResolver)ci.getCacheResolver()).getCacheManager());
    context.close();
  }
View Full Code Here

  @Test
  public void bothSetOnlyResolverIsUsed() {
    ConfigurableApplicationContext context =
        new AnnotationConfigApplicationContext(FullCachingConfig.class);

    CacheInterceptor ci = context.getBean(CacheInterceptor.class);
    assertSame(context.getBean("cacheResolver"), ci.getCacheResolver());
    assertSame(context.getBean("keyGenerator"), ci.getKeyGenerator());
    context.close();
  }
View Full Code Here

  }

  @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;
  }
View Full Code Here

TOP

Related Classes of org.springframework.cache.interceptor.CacheInterceptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.