mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-15 12:15:50 +00:00
Polish
This commit is contained in:
parent
5ff057d90b
commit
3c9afdc138
1 changed files with 9 additions and 9 deletions
|
@ -1,27 +1,27 @@
|
||||||
package org.springframework.samples.petclinic.system;
|
package org.springframework.samples.petclinic.system;
|
||||||
|
|
||||||
import javax.cache.configuration.Configuration;
|
|
||||||
import javax.cache.configuration.MutableConfiguration;
|
import javax.cache.configuration.MutableConfiguration;
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
|
import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
|
||||||
import org.springframework.cache.annotation.EnableCaching;
|
import org.springframework.cache.annotation.EnableCaching;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
@org.springframework.context.annotation.Configuration
|
@Configuration
|
||||||
@EnableCaching
|
@EnableCaching
|
||||||
class CacheConfig {
|
class CacheConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JCacheManagerCustomizer cacheManagerCustomizer() {
|
public JCacheManagerCustomizer petclinicCacheConfigurationCustomizer() {
|
||||||
return cm -> {
|
return cm -> {
|
||||||
Configuration<Object, Object> cacheConfiguration = createCacheConfiguration();
|
cm.createCache("vets", cacheConfiguration());
|
||||||
cm.createCache("vets", cacheConfiguration);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private Configuration<Object, Object> createCacheConfiguration() {
|
private javax.cache.configuration.Configuration<Object, Object> cacheConfiguration() {
|
||||||
// Create a cache using infinite heap. A real application will want to use an
|
// Create a cache using infinite heap. A real application will want to use a more fine-grained configuration,
|
||||||
// implementation dependent configuration that will better fit your needs
|
// possibly using an implementation-dependent API
|
||||||
return new MutableConfiguration<>().setStatisticsEnabled(true);
|
return new MutableConfiguration<>().setStatisticsEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue