2017-09-08 39 views
0

在我的Java项目中,我将spring迁移到 - > 4.3.4,并将ehcache-spring-annotation迁移到http://www.springframework.org/schema/cacheSpring 4 @cacheable注解:如何为自定义密钥生成器添加属性?

我有问题,我的定义缓存customkeygenerator的属性:

@Cacheable(value = "cacheDAO", keyGenerator = @KeyGenerator(name = "CacheKeyGenerator", 
     properties = { @Property(name = "useReflection", value = "true"), 
         @Property(name = "checkforCycles", value = "true"), 
         @Property(name = "includeMethod", value = "false") }) 

似乎不可能由@keyGenerator注释来定义useReflection,checkForCycles或includeMethod。

你能帮我配置吗?春天4怎么样? 请告诉我,如果你不明白我的问题。

谢谢!

回答

0

根据the documentation,似乎不可能内联。然而,使用相同的密钥生成器配置特定的bean,但将不同的属性值映射到不同的bean名称是非常简单的。然后你引用@Cacheable注释中的确切一个。