Skip to content
Snippets Groups Projects
Commit 3c9afdc1 authored by Stephane Nicoll's avatar Stephane Nicoll
Browse files

Polish

parent 5ff057d9
No related branches found
No related tags found
No related merge requests found
package org.springframework.samples.petclinic.system;
import javax.cache.configuration.Configuration;
import javax.cache.configuration.MutableConfiguration;
import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@org.springframework.context.annotation.Configuration
@Configuration
@EnableCaching
class CacheConfig {
class CacheConfiguration {
@Bean
public JCacheManagerCustomizer cacheManagerCustomizer() {
public JCacheManagerCustomizer petclinicCacheConfigurationCustomizer() {
return cm -> {
Configuration<Object, Object> cacheConfiguration = createCacheConfiguration();
cm.createCache("vets", cacheConfiguration);
cm.createCache("vets", cacheConfiguration());
};
}
private Configuration<Object, Object> createCacheConfiguration() {
// Create a cache using infinite heap. A real application will want to use an
// implementation dependent configuration that will better fit your needs
private javax.cache.configuration.Configuration<Object, Object> cacheConfiguration() {
// Create a cache using infinite heap. A real application will want to use a more fine-grained configuration,
// possibly using an implementation-dependent API
return new MutableConfiguration<>().setStatisticsEnabled(true);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment