gpt4 book ai didi

java - Spring @Cachable : Not working on methods with parameters

转载 作者:行者123 更新时间:2023-12-01 17:33:34 24 4
gpt4 key购买 nike

我想尝试 Spring 3.1 缓存抽象,用 @Cachable 注释一些方法。这在没有参数的方法上工作得很好。对于带有参数的方法则不然。在文档中找不到任何内容(http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/cache.html)。

有人遇到同样的事情吗?

调用的方法是:

@Cachable("countries") 
public List<ConfigEntity> findCountries(Locale locale) {
ConfigSearchDescription desc = new ConfigSearchDescription();
// ...
return findConfigs(desc);
}

谢谢乔尼

最佳答案

Are you calling this method from another method of the same bean? Remember that in this case proxies usually can't intercept these calls.

这是我的错误。

感谢大家的帮助

关于java - Spring @Cachable : Not working on methods with parameters,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8559241/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com