本文整理汇总了Java中org.springframework.cache.support.NoOpCacheManager类的典型用法代码示例。如果您正苦于以下问题:Java NoOpCacheManager类的具体用法?Java NoOpCacheManager怎么用?Java NoOpCacheManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NoOpCacheManager类属于org.springframework.cache.support包,在下文中一共展示了NoOpCacheManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: noOpCacheStatisticsProvider
import org.springframework.cache.support.NoOpCacheManager; //导入依赖的package包/类
@Bean
public CacheStatisticsProvider<Cache> noOpCacheStatisticsProvider() {
return new CacheStatisticsProvider<Cache>() {
@Override
public CacheStatistics getCacheStatistics(CacheManager cacheManager,
Cache cache) {
if (cacheManager instanceof NoOpCacheManager) {
return NO_OP_STATS;
}
return null;
}
};
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:CacheStatisticsAutoConfiguration.java
示例2: whenSpringCacheTypeIsNoneThenNoOpCacheLoaded
import org.springframework.cache.support.NoOpCacheManager; //导入依赖的package包/类
@Test
public void whenSpringCacheTypeIsNoneThenNoOpCacheLoaded() {
loadContext(CacheConfiguration.class, "spring.cache.type=none");
CacheManager cacheManager = this.applicationContext.getBean(CacheManager.class);
assertThat(cacheManager).isInstanceOf(NoOpCacheManager.class);
}
示例3: sourceWriteSameVersion
import org.springframework.cache.support.NoOpCacheManager; //导入依赖的package包/类
@Test
public void sourceWriteSameVersion() throws Exception {
User specificRecord = new User();
specificRecord.setName("joe");
Schema v1 = new Schema.Parser().parse(AvroMessageConverterSerializationTests.class
.getClassLoader().getResourceAsStream("schemas/user.avsc"));
GenericRecord genericRecord = new GenericData.Record(v1);
genericRecord.put("name", "joe");
SchemaRegistryClient client = new DefaultSchemaRegistryClient();
AvroSchemaRegistryClientMessageConverter converter = new AvroSchemaRegistryClientMessageConverter(
client, new NoOpCacheManager());
converter.setSubjectNamingStrategy(new DefaultSubjectNamingStrategy());
converter.setDynamicSchemaGenerationEnabled(false);
converter.afterPropertiesSet();
Message specificMessage = converter.toMessage(specificRecord,
new MutableMessageHeaders(Collections.<String, Object> emptyMap()),
MimeTypeUtils.parseMimeType("application/*+avro"));
SchemaReference specificRef = extractSchemaReference(MimeTypeUtils.parseMimeType(
specificMessage.getHeaders().get("contentType").toString()));
Message genericMessage = converter.toMessage(genericRecord,
new MutableMessageHeaders(Collections.<String, Object> emptyMap()),
MimeTypeUtils.parseMimeType("application/*+avro"));
SchemaReference genericRef = extractSchemaReference(MimeTypeUtils.parseMimeType(
genericMessage.getHeaders().get("contentType").toString()));
Assert.assertEquals(genericRef, specificRef);
Assert.assertEquals(1, genericRef.getVersion());
}
开发者ID:spring-cloud,项目名称:spring-cloud-stream,代码行数:32,代码来源:AvroMessageConverterSerializationTests.java
示例4: testOriginalContentTypeHeaderOnly
import org.springframework.cache.support.NoOpCacheManager; //导入依赖的package包/类
@Test
public void testOriginalContentTypeHeaderOnly() throws Exception {
User specificRecord = new User();
specificRecord.setName("joe");
Schema v1 = new Schema.Parser().parse(AvroMessageConverterSerializationTests.class
.getClassLoader().getResourceAsStream("schemas/user.avsc"));
GenericRecord genericRecord = new GenericData.Record(v1);
genericRecord.put("name", "joe");
SchemaRegistryClient client = new DefaultSchemaRegistryClient();
client.register("user", "avro", v1.toString());
AvroSchemaRegistryClientMessageConverter converter = new AvroSchemaRegistryClientMessageConverter(
client, new NoOpCacheManager());
converter.setDynamicSchemaGenerationEnabled(false);
converter.afterPropertiesSet();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DatumWriter<User> writer = new SpecificDatumWriter<>(User.class);
Encoder encoder = EncoderFactory.get().binaryEncoder(baos, null);
writer.write(specificRecord, encoder);
encoder.flush();
Message source = MessageBuilder.withPayload(baos.toByteArray())
.setHeader(MessageHeaders.CONTENT_TYPE,
MimeTypeUtils.APPLICATION_OCTET_STREAM)
.setHeader(BinderHeaders.BINDER_ORIGINAL_CONTENT_TYPE,
"application/vnd.user.v1+avro")
.build();
Object converted = converter.fromMessage(source, User.class);
Assert.assertNotNull(converted);
Assert.assertEquals(specificRecord.getName().toString(),
((User) converted).getName().toString());
}
开发者ID:spring-cloud,项目名称:spring-cloud-stream,代码行数:32,代码来源:AvroMessageConverterSerializationTests.java
示例5: testNoCacheConfiguration
import org.springframework.cache.support.NoOpCacheManager; //导入依赖的package包/类
@Test
public void testNoCacheConfiguration() {
ConfigurableApplicationContext sourceContext = SpringApplication.run(NoCacheConfiguration.class,
"--spring.main.web-environment=false");
AvroSchemaRegistryClientMessageConverter converter = sourceContext
.getBean(AvroSchemaRegistryClientMessageConverter.class);
DirectFieldAccessor accessor = new DirectFieldAccessor(converter);
assertThat(accessor.getPropertyValue("cacheManager")).isInstanceOf(NoOpCacheManager.class);
}
开发者ID:spring-cloud,项目名称:spring-cloud-stream,代码行数:10,代码来源:AvroSchemaRegistryClientMessageConverterTests.java
示例6: setUp
import org.springframework.cache.support.NoOpCacheManager; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
Mongo mongo = embeddedMongoDbRule.getDatabaseOperation().connectionManager();
final AclCache aclCache = new SpringCacheBasedAclCache(new NoOpCacheManager().getCache("acl"), pgs, aas);
fixture = new MongoMutableAclService(mongo, "test", aclCache, pgs, aas);
fixture.afterPropertiesSet();
SecurityContextHolder.getContext()
.setAuthentication(new PreAuthenticatedAuthenticationToken("[email protected]", "password"));
}
示例7: setUp
import org.springframework.cache.support.NoOpCacheManager; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
Mongo mongo = embeddedMongoDbRule.getDatabaseOperation().connectionManager();
final AclCache aclCache = new SpringCacheBasedAclCache(new NoOpCacheManager().getCache("acl"), pgs, aas);
fixture = new MongoAclService(mongo, "test", aclCache, pgs, aas);
fixture.afterPropertiesSet();
}
示例8: cacheManager
import org.springframework.cache.support.NoOpCacheManager; //导入依赖的package包/类
@Bean
public CacheManager cacheManager() {
log.debug("No cache");
return new NoOpCacheManager();
}
示例9: cm1
import org.springframework.cache.support.NoOpCacheManager; //导入依赖的package包/类
@Bean
public CacheManager cm1() {
return new NoOpCacheManager();
}
示例10: cm2
import org.springframework.cache.support.NoOpCacheManager; //导入依赖的package包/类
@Bean
public CacheManager cm2() {
return new NoOpCacheManager();
}
示例11: cm
import org.springframework.cache.support.NoOpCacheManager; //导入依赖的package包/类
@Bean
public CacheManager cm() {
return new NoOpCacheManager();
}
示例12: cacheManager
import org.springframework.cache.support.NoOpCacheManager; //导入依赖的package包/类
@Override
@Bean
public CacheManager cacheManager() {
return new NoOpCacheManager();
}
示例13: setup
import org.springframework.cache.support.NoOpCacheManager; //导入依赖的package包/类
@Before
public void setup() {
manager = new NoOpCacheManager();
}
示例14: mgr
import org.springframework.cache.support.NoOpCacheManager; //导入依赖的package包/类
@Bean
CacheManager mgr() {
return new NoOpCacheManager();
}
示例15: cacheManager
import org.springframework.cache.support.NoOpCacheManager; //导入依赖的package包/类
@Bean
CacheManager cacheManager() {
return new NoOpCacheManager();
}