0
我在Spring + Hibernate中實現了應用程序。爲了優化ORM操作我都接着this教程,使監測的Ehcache:通過JMX監控Ehcache
@EnableWebMvc
@EnableSpringDataWebSupport
@EnableCaching
...
public class SpringWebConfig extends WebMvcConfigurerAdapter {
....
@Bean
public EhCacheCacheManager ehCacheManager() {
EhCacheCacheManager cacheManager = new EhCacheCacheManager();
cacheManager.setCacheManager((net.sf.ehcache.CacheManager) ehCacheManagerFactory().getObject());
return cacheManager;
}
@Bean
public EhCacheManagerFactoryBean ehCacheManagerFactory() {
EhCacheManagerFactoryBean cmfb = new EhCacheManagerFactoryBean();
cmfb.setConfigLocation(new ClassPathResource("ehcache.xml"));
cmfb.setShared(true);
return cmfb;
}
@Bean
public ManagementService managementService() {
return new ManagementService(ehCacheManager().getCacheManager(), mBeanServer(), true, true, true, true);
}
@Bean
public MBeanServer mBeanServer() {
MBeanServer bean = ManagementFactory.getPlatformMBeanServer();
return bean;
}
}
但是我看不到任何ehache豆在JConsole:
你知道,如果我錯過了什麼,以啓用統計?
是的,它的工作。感謝您的解釋! – bontade