我正在使用,它需要定义缓存。到目前为止我还在用这个:
@Bean(name = { "defaultAclCache", "aclCache" })
protected AclCache defaultAclCache() {
return new SpringCacheBasedAclCache(defaultAclJCacheFactory(), defaultPermissionGrantingStrategy(), defaultAclAuthorizationStrategy());
}一切都很顺利。但是,我切换到使用jcache,现在defaultAclJCacheFactory()返回一个与SpringCacheBasedAclCache不兼容的javax.cache.Cache实例。
@Bean(name = { "defaultAclJCacheFactory", "aclJCacheFactory" })
protected Cache defaultAclJCacheFactory() {
return cacheManager.getCache("acl_cache");
}我试图搜索JCache实现的org.springframework.security.acls.model.AclCache,但只有这个用于春季缓存和一个EhCache。是否有计划为jcache推出一个
发布于 2014-06-11 13:39:00
您应该能够使用JCacheCacheManager实现来获取org.springframework.cache.Cache的实例,例如:
@Bean(name = { "defaultAclCache", "aclCache" })
protected AclCache defaultAclCache(org.springframework.cache.CacheManager springCacheManager) {
org.springframework.cache.Cache cache =
springCacheManager.getCache("acl_cache");
return new SpringCacheBasedAclCache(cache,
defaultPermissionGrantingStrategy(),
defaultAclAuthorizationStrategy());
}
// Depending on your configuration, you may not even need this
@Bean
public JCacheCacheManager springCacheManager(javax.cache.CacheManager cacheManager) {
return new JCacheCacheManager(cacheManager);
}https://stackoverflow.com/questions/24144702
复制相似问题