备忘 springboot 整合ehcache,注入CacheManager时提示 required a bean of type 'org.springframework.cache.CacheManager' that could not be found
问题因人而异,此处仅做备忘
整合过程:
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的更多相关文章
- SpringBoot中service注入失败(A component required a bean of type 'XXService' that could not found)
先写了JUnit,发现启动不了,注释掉有问题的service也不可以.可能是因为spring开始时会加载所有service吧. 按照网友们的说法,一般需要检查: 1.入口类有没有写MapperScan ...
- SpringBoot扫描不到类,注入失败A component required a bean of type 'XXService' that could...
SpringBoot项目的Bean装配默认规则是根据Application类所在的包位置从上往下扫描! “Application类”是指SpringBoot项目入口类.这个类的位置很关键: 如果App ...
- 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 ...
- 【spring-boot】spring-boot 整合 ehcache 实现缓存机制
方式一:老 不推荐 参考:https://www.cnblogs.com/lic309/p/4072848.html /*************************第一种 引入 ehcach ...
- 【Springboot】Springboot整合Ehcache
刚刚项目上线了,记录下使用的技术...... EhCache 是一个纯Java的进程内缓存框架,具有快速.精干等特点,是Hibernate中默认的CacheProvider. Ehcache的特点 ( ...
- springboot 工程启动报错之Consider defining a bean of type ‘XXX’ in your configuration.
一.前言: 使用springboot自动注入的方式搭建好了工程,结果启动的时候报错了!!!,错误如下图: Description: Field userEntityMapper in com.xxx. ...
- 安装mysql时 make 时 提示 redeclaration of C++ built-in type ‘bool’ 错误
安装mysql时 make 时 提示 redeclaration of C++ built-in type ‘bool’ 错误 由于gcc-c++是在./configure后进行编译的 重新./con ...
- 运行springboot项目报错:Field userMapper in XX required a bean of type 'xx' that could not be found.
运行springboot项目报错: *************************** APPLICATION FAILED TO START ************************** ...
- SpringBoot整合EHcache学习笔记
为了提高系统的运行效率,引入缓存机制,减少数据库访问和磁盘IO.下面说明一下ehcache和SpringBoot整合配置 前言介绍 EhCache 是一个纯Java的进程内缓存框架,具有快速.精干等特 ...
- spring-boot整合ehcache实现缓存机制
EhCache 是一个纯Java的进程内缓存框架,具有快速.精干等特点,是Hibernate中默认的CacheProvider. ehcache提供了多种缓存策略,主要分为内存和磁盘两级,所以无需担心 ...
随机推荐
- SpringCore完整学习教程3,入门级别
从第三章开始 3. Profiles Spring profile提供了一种方法来隔离应用程序配置的各个部分,并使其仅在某些环境中可用.任何@Component.@Configuration或@Con ...
- [GDOIpj222B] 网页浏览
第二题 网页浏览 提交文件: webpage.cpp 输入文件: webpage.in 输出文件: webpage.out 时间空间限制: 1 秒, 256 MB 我们在上网时,从一个网页上的链接打开 ...
- 一文读懂遗传算法(附python)
几天前,我着手解决一个实际问题--大型超市销售问题.在使用了几个简单模型做了一些特征工程之后,我在排行榜上名列第 219 名. 虽然结果不错,但是我还是想做得更好.于是,我开始研究可以提高分数的优化方 ...
- 将Abp默认事件总线改造为分布式事件总线
@ 目录 原理 创建分布式事件总线 实现自动订阅和事件转发 使用 启动Redis服务 配置 传递Abp默认事件 传递自定义事件 项目地址 原理 本地事件总线是通过Ioc容器来实现的. IEventBu ...
- 安装华企盾DSC加密软件,USB、银行key等驱动加载不了常见处理方法
1.首先打开高级客户端查看客户端的权限是否正确 2.将USB设置成放行 3.修改USB管控的注册表 4.安装6.6.0高版本,并添加便捷式设备的注册表改为1见下图 5.添加flag000如正常则把相关 ...
- 华企盾DSC客户端服务无法启动一直处于启动停止状态
该问题有两种情况: 1.客户端安装有问题,5097目录缺少文件,解决方法见下面详细信息 2.客户端本地数据库出现问题,需要卸载客户端以及删除对应的本地数据库备份文件(解决方法见下面详细信息) 3.由于 ...
- JDK1.8下载 用阿里云盘
JDK1.8下载 用阿里云盘 jdk-8u202-windows-x64.exe https://www.aliyundrive.com/s/jJhWUk17jMt 点击链接保存,或者复制本段内容,打 ...
- Using PostMessage/SendMessage to send keys to c# IE WebBrowser
[DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] static extern bool PostM ...
- CTFHub SSRF Redis协议 WriteUp
CTFHub SSRF Redis协议 进入环境,可以看到url格式为: http://challenge-2c082607df3fa433.sandbox.ctfhub.com:10800/?url ...
- C 按位显示二进制
转载:https://mp.weixin.qq.com/s?__biz=Mzk0NDYzNTI1Ng==&mid=2247483733&idx=2&sn=728c93b046d ...