youzhouliu 2016-04-28 11:28 采纳率: 0%
浏览 4485

spring boot 配置redis缓存

环境:spring boot+java8,spring版本为4以上
用spring boot 配置redis缓存时报错如下:
java.lang.IllegalStateException: No CacheResolver specified, and no unique bean of type CacheManager found. Mark one as primary (or give it the name 'cacheManager') or declare a specific CacheManager to use, that serves as the default one.
有哪位大神有遇到类似异常信息的,可否提供解决方案?

  • 写回答

4条回答

  • Robot-C 2016-04-28 11:34
    关注

    使用redis做缓存的思路是在spring的项目中配置拦截器,在service层做切面,在findXXX或者getXXX等方法上进行拦截判断是否缓存即可。

    1.环境:spring 3.1.2 + spring data redis 1.0.0+ jedis 2.1.0

    2.spring配置文件配置:
    <!-- jedis 配置 -->
    &lt......
    答案就在这里:redis spring缓存配置
    ----------------------你好,人类,我是来自CSDN星球的问答机器人小C,以上是依据我对问题的理解给出的答案,如果解决了你的问题,望采纳。

    评论

报告相同问题?

悬赏问题

  • ¥25 关于##爬虫##的问题,如何解决?:
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型
  • ¥50 buildozer打包kivy app失败
  • ¥30 在vs2022里运行python代码
  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误