Package org.springframework.cache.interceptor

Examples of org.springframework.cache.interceptor.CacheInterceptor$ThrowableWrapper


  }

  @Bean
  @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
  public CacheInterceptor cacheInterceptor() {
    CacheInterceptor interceptor = new CacheInterceptor();
    interceptor.setCacheOperationSources(cacheOperationSource());
    if (this.cacheManager != null) {
      interceptor.setCacheManager(this.cacheManager);
    }
    if (this.keyGenerator != null) {
      interceptor.setKeyGenerator(this.keyGenerator);
    }
    return interceptor;
  }
View Full Code Here


  }

  @Bean
  @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
  public CacheInterceptor cacheInterceptor() {
    CacheInterceptor interceptor = new CacheInterceptor();
    interceptor.setCacheOperationSources(cacheOperationSource());
    if (this.cacheManager != null) {
      interceptor.setCacheManager(this.cacheManager);
    }
    if (this.keyGenerator != null) {
      interceptor.setKeyGenerator(this.keyGenerator);
    }
    return interceptor;
  }
View Full Code Here

        "/org/springframework/cache/config/annotationDrivenCacheNamespace.xml");
  }

  @Test
  public void testKeyStrategy() {
    CacheInterceptor ci = ctx.getBean("org.springframework.cache.interceptor.CacheInterceptor#0",
        CacheInterceptor.class);
    assertSame(ctx.getBean("keyGenerator"), ci.getKeyGenerator());
  }
View Full Code Here

  @Test
  public void cacheResolver() {
    ConfigurableApplicationContext context = new GenericXmlApplicationContext(
        "/org/springframework/cache/config/annotationDrivenCacheNamespace-resolver.xml");

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

  @Test
  public void bothSetOnlyResolverIsUsed() {
    ConfigurableApplicationContext context = new GenericXmlApplicationContext(
        "/org/springframework/cache/config/annotationDrivenCacheNamespace-manager-resolver.xml");

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

    context.close();
  }

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

  @Test
  public void onlyOneInterceptorIsAvailable() {
    Map<String, CacheInterceptor> interceptors = ctx.getBeansOfType(CacheInterceptor.class);
    assertEquals("Only one interceptor should be defined", 1, interceptors.size());
    CacheInterceptor interceptor = interceptors.values().iterator().next();
    assertEquals("Custom interceptor not defined", TestCacheInterceptor.class, interceptor.getClass());
  }
View Full Code Here

      return new DefaultCacheableService();
    }

    @Bean
    public CacheInterceptor cacheInterceptor(CacheOperationSource cacheOperationSource) {
      CacheInterceptor cacheInterceptor = new TestCacheInterceptor();
      cacheInterceptor.setCacheManager(cacheManager());
      cacheInterceptor.setCacheOperationSources(cacheOperationSource);
      return cacheInterceptor;
    }
View Full Code Here

        "/org/springframework/cache/config/cache-advice.xml");
  }

  @Test
  public void testKeyStrategy() throws Exception {
    CacheInterceptor bean = ctx.getBean("cacheAdviceClass", CacheInterceptor.class);
    Assert.assertSame(ctx.getBean("keyGenerator"), bean.getKeyGenerator());
  }
View Full Code Here

    return new AnnotationConfigApplicationContext(EnableCachingConfig.class);
  }

  @Test
  public void testKeyStrategy() {
    CacheInterceptor ci = ctx.getBean(CacheInterceptor.class);
    assertSame(ctx.getBean("keyGenerator", KeyGenerator.class), ci.getKeyGenerator());
  }
View Full Code Here

TOP

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

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.