Py学习  »  Dovmo  »  全部回复
回复总数  1

正如你所指出的,尝试 #p0 和 #p1 不起作用。因为它引用了 参数 方法…你的案子里没有!见:

// #p0 and #p1 reference non-existing method parameters...
@Cacheable(value = "celebcache", key = "#p0") 
public List<Celeb> getAll(/* zero input parameters */) { ... }

每 the docs here ,您不必指定 key 完全:

如果没有给出参数,则返回simplekey.empty

因此,以下内容就足够了:

@Cacheable(value = "celebcache")