org.springframework.cache.interceptor.NamedCacheResolver Java Examples

The following examples show how to use org.springframework.cache.interceptor.NamedCacheResolver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JCacheInterceptorTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void severalCachesNotSupported() {
	JCacheInterceptor interceptor = createInterceptor(createOperationSource(
			cacheManager, new NamedCacheResolver(cacheManager, "default", "simpleCache"),
			defaultExceptionCacheResolver, defaultKeyGenerator));

	AnnotatedJCacheableService service = new AnnotatedJCacheableService(cacheManager.getCache("default"));
	Method m = ReflectionUtils.findMethod(AnnotatedJCacheableService.class, "cache", String.class);

	assertThatIllegalStateException().isThrownBy(() ->
			interceptor.execute(dummyInvoker, service, m, new Object[] {"myId"}))
		.withMessageContaining("JSR-107 only supports a single cache");
}
 
Example #2
Source File: JCacheInterceptorTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void noCacheCouldBeResolved() {
	JCacheInterceptor interceptor = createInterceptor(createOperationSource(
			cacheManager, new NamedCacheResolver(cacheManager), // Returns empty list
			defaultExceptionCacheResolver, defaultKeyGenerator));

	AnnotatedJCacheableService service = new AnnotatedJCacheableService(cacheManager.getCache("default"));
	Method m = ReflectionUtils.findMethod(AnnotatedJCacheableService.class, "cache", String.class);
	assertThatIllegalStateException().isThrownBy(() ->
			interceptor.execute(dummyInvoker, service, m, new Object[] {"myId"}))
		.withMessageContaining("Cache could not have been resolved for");
}
 
Example #3
Source File: EnableCachingTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
@Bean
public CacheResolver cacheResolver() {
	return new NamedCacheResolver(cacheManager(), "foo");
}
 
Example #4
Source File: JCacheJavaConfigTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
@Bean
public CacheResolver cacheResolver() {
	return new NamedCacheResolver(cacheManager(), "foo");
}
 
Example #5
Source File: JCacheJavaConfigTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
@Bean
public CacheResolver exceptionCacheResolver() {
	return new NamedCacheResolver(cacheManager(), "exception");
}
 
Example #6
Source File: JCacheJavaConfigTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
@Bean
public CacheResolver cacheResolver() {
	return new NamedCacheResolver(new ConcurrentMapCacheManager(), "default");
}
 
Example #7
Source File: AspectJEnableCachingIsolatedTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
@Bean
public CacheResolver cacheResolver() {
	return new NamedCacheResolver(cacheManager(), "foo");
}
 
Example #8
Source File: EnableCachingTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
@Bean
public CacheResolver cacheResolver() {
	return new NamedCacheResolver(cacheManager(), "foo");
}
 
Example #9
Source File: JCacheJavaConfigTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
@Bean
public CacheResolver cacheResolver() {
	return new NamedCacheResolver(cacheManager(), "foo");
}
 
Example #10
Source File: JCacheJavaConfigTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
@Bean
public CacheResolver exceptionCacheResolver() {
	return new NamedCacheResolver(cacheManager(), "exception");
}
 
Example #11
Source File: JCacheJavaConfigTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
@Bean
public CacheResolver cacheResolver() {
	return new NamedCacheResolver(new ConcurrentMapCacheManager(), "default");
}
 
Example #12
Source File: AspectJEnableCachingIsolatedTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
@Bean
public CacheResolver cacheResolver() {
	return new NamedCacheResolver(cacheManager(), "foo");
}
 
Example #13
Source File: EnableCachingTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
@Bean
public CacheResolver cacheResolver() {
	return new NamedCacheResolver(cacheManager(), "foo");
}
 
Example #14
Source File: JCacheJavaConfigTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
@Bean
public CacheResolver cacheResolver() {
	return new NamedCacheResolver(cacheManager(), "foo");
}
 
Example #15
Source File: JCacheJavaConfigTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
@Bean
public CacheResolver exceptionCacheResolver() {
	return new NamedCacheResolver(cacheManager(), "exception");
}
 
Example #16
Source File: JCacheJavaConfigTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
@Bean
public CacheResolver cacheResolver() {
	return new NamedCacheResolver(new ConcurrentMapCacheManager(), "default");
}