【问题标题】:RedisCacheManager autowired in code but not working as expectedRedisCacheManager 在代码中自动装配,但未按预期工作
【发布时间】:2017-10-03 20:59:19
【问题描述】:

我正在使用 Spring 在 Redis 中使用 @Cacheable(value="bus_availability", key="#sourceCity") spring 注释来缓存数据。 但是每当尝试使用 RedisCacheManager 访问它时,我都没有得到结果。 就像 redisCacheManager.getCacheNames() 返回空数组一样。

【问题讨论】:

  • 如果我错了请纠正我“bus_availability”将是缓存名称。

标签: spring spring-mvc caching redis spring-cache


【解决方案1】:

我做了一些研究并解决了这个问题。我从同一个类调用方法,所以代理概念不适用于 bean。 所以现在我把它移到另一个 bean 中,它现在可以正常工作了

【讨论】:

    猜你喜欢
    • 2011-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-06
    相关资源
    最近更新 更多