问题因人而异,此处仅做备忘

整合过程:

1、添加maven依赖

        <dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.10.6</version>
</dependency>

2、开启springboot缓存

@EnableCaching
@SpringBootApplication
public class EhcachetestApplication { public static void main(String[] args) {
SpringApplication.run(EhcachetestApplication.class, args);
} }

3、在使用位置注入 org.springframework.cache.CacheManager

注:上面飘红并不是报错的原因,可忽略。

4、打包测试,报 required a bean of type 'org.springframework.cache.CacheManager' that could not be found

5、增加 spring-boot-starter-cache 依赖

        <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>

6、再次打包测试,一切OK

问题原因分析:

spring-boot-starter-cache 是springboot缓存功能的依赖,如果要开启springboot cache必需添加该依赖。这次因为这个地方忽视,造成调错花费了不少时间,记录下来加深记忆!

备忘 springboot 整合ehcache,注入CacheManager时提示 required a bean of type 'org.springframework.cache.CacheManager' that could not be found的更多相关文章

  1. SpringBoot中service注入失败(A component required a bean of type 'XXService' that could not found)

    先写了JUnit,发现启动不了,注释掉有问题的service也不可以.可能是因为spring开始时会加载所有service吧. 按照网友们的说法,一般需要检查: 1.入口类有没有写MapperScan ...

  2. SpringBoot扫描不到类,注入失败A component required a bean of type 'XXService' that could...

    SpringBoot项目的Bean装配默认规则是根据Application类所在的包位置从上往下扫描! “Application类”是指SpringBoot项目入口类.这个类的位置很关键: 如果App ...

  3. springboot做邮件发送功能时报错No qualifying bean of type 'org.springframework.mail.javamail.JavaMailSender' available:的问题解决方案

    1.检查application.yml中的配置是否正确 spring.mail.host=smtp.xxx.comspring.mail.username=xxx@xxx.comspring.mail ...

  4. 【spring-boot】spring-boot 整合 ehcache 实现缓存机制

    方式一:老 不推荐 参考:https://www.cnblogs.com/lic309/p/4072848.html /*************************第一种   引入 ehcach ...

  5. 【Springboot】Springboot整合Ehcache

    刚刚项目上线了,记录下使用的技术...... EhCache 是一个纯Java的进程内缓存框架,具有快速.精干等特点,是Hibernate中默认的CacheProvider. Ehcache的特点 ( ...

  6. springboot 工程启动报错之Consider defining a bean of type ‘XXX’ in your configuration.

    一.前言: 使用springboot自动注入的方式搭建好了工程,结果启动的时候报错了!!!,错误如下图: Description: Field userEntityMapper in com.xxx. ...

  7. 安装mysql时 make 时 提示 redeclaration of C++ built-in type ‘bool’ 错误

    安装mysql时 make 时 提示 redeclaration of C++ built-in type ‘bool’ 错误 由于gcc-c++是在./configure后进行编译的 重新./con ...

  8. 运行springboot项目报错:Field userMapper in XX required a bean of type 'xx' that could not be found.

    运行springboot项目报错: *************************** APPLICATION FAILED TO START ************************** ...

  9. SpringBoot整合EHcache学习笔记

    为了提高系统的运行效率,引入缓存机制,减少数据库访问和磁盘IO.下面说明一下ehcache和SpringBoot整合配置 前言介绍 EhCache 是一个纯Java的进程内缓存框架,具有快速.精干等特 ...

  10. spring-boot整合ehcache实现缓存机制

    EhCache 是一个纯Java的进程内缓存框架,具有快速.精干等特点,是Hibernate中默认的CacheProvider. ehcache提供了多种缓存策略,主要分为内存和磁盘两级,所以无需担心 ...

随机推荐

  1. python之字符串format()方法

    format()方法就是格式化指定的值,然后再将其插入字符串的占位符内 占位符用大括号{}来定义哈,可以使用命名索引{sws}.编号索引{0}.甚至空的占位符{}来标识占位符. 语法就是 string ...

  2. SpringBoot + 通义千问 + 自定义React组件,支持EventStream数据解析!

    一.前言 大家好!我是sum墨,一个一线的底层码农,平时喜欢研究和思考一些技术相关的问题并整理成文,限于本人水平,如果文章和代码有表述不当之处,还请不吝赐教. 最近ChatGPT非常受欢迎,尤其是在编 ...

  3. mac端 安卓UI自动化安装环境配置

    安装JDK   官网下载安装包https://www.oracle.com/java/technologies/javase/javase8u211-later-archive-downloads.h ...

  4. kirin的博客

    本站内容全部为作者学习期间和工作期间整理的笔记,除部分文章转载外,原创文章内容不存在侵权!但部分图片来源于网络,如有侵权可联系作者删除! WX:kirin_zhang0124 学无止境 你是谁,只有你 ...

  5. 【Javaweb】什么是Listener监听器?

    1.Listener监听器它是Javaweb的三大组件之一.Javaweb的三大组件分别是:Servelt程序,Filter过滤器,Listener监听器. 2.Listener它是JavaEE的规范 ...

  6. C++20语言核心特性的变化

    using for Enumeration Values   对比一下C++20前后的区别: enum class State { open, progress, done = 9 }; // Bef ...

  7. C#12新功能有哪些?

    前言 作为.NET 8发布会的一部分,微软于11月14日发布了C#12的新功能,这也是目前.NET的最新版本.正如之前公布的那样,最显著的改进包括了集合表达式.主构造函数.任何类型的别名以及lambd ...

  8. Mysql不同数据库之间表结构同步

    开发环境的Mysql表结构做了修改,要同步到其他环境数据库中使用数据库管理工具JookDB的表结构同步功能就很方便.虽然Navicat也有这个功能但是有免费的当然是用免费的. 用JookDB添加数据库 ...

  9. 【C++】【图像处理】均值滤波 and 高斯滤波 and 中值滤波 (低通滤波器)and Sobel算子边缘提取算法解析(以.raw格式的图像为基础进行图像处理、gray levels:256)

    1 void meanFilter(BYTE* image, int width, int height, BYTE* outImg) 2 { 3 //均值滤波 4 int smth[9]; 5 in ...

  10. 超轻量级MP4封装方法介绍

    liwen01 2023.12.17 前言 MP4是目前非常常用的一种视频封装格式,关于MP4的介绍资料也非常多.我们常用的封装库或工具有:ffmpeg,libmp4v2,GPAC,MP4.js,它们 ...