if(cacheable){
EhCacheFactoryBean cacheFactory = new EhCacheFactoryBean();
//use default cache manager CacheManager.getInstance();
cacheFactory.setCacheName("messageCache");
try {
cacheFactory.afterPropertiesSet();
} catch (Exception e) {
throw new IllegalStateException(e.getMessage(), e);
}
messageResolver.setCacheable(true);
messageResolver.setCache(cacheFactory.getObject());