备忘 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提供了多种缓存策略,主要分为内存和磁盘两级,所以无需担心 ...
随机推荐
- DataGrip安装与使用
写在前面:同学们记得以命令为主,图形界面为辅.了解图形怎么操作即可 一.DataGrip软件的安装和初始化 首先在浏览器上搜索datagrip,然后打开连接 点击DOWNLOAD 按照你电脑系统来 ...
- 抽象工厂(Abstract Factory)
模式定义 提供一个接口, 让该接口负责创建一系列'相关或者相互依赖的对象' , 无需指定他们具体的类 要点总结 如果没有应对'多系列对象构建'的需求变化 ,则没有必要使用Abstract Factor ...
- offline RL | IQL:通过 sarsa 式 Q 更新避免 unseen actions
题目:Offline Reinforcement Learning with Implicit Q-Learning,Sergey Levine 组,2022 ICLR,5 6 8. pdf 版本:h ...
- 基于Browscap对浏览器工具类优化
项目背景 原有的启动平台公共组件库comm-util的浏览器工具类BrowserUtils是基于UserAgentUtils的,但是该项目最后一个版本发布于 2018/01/24,之至今日23年底,已 ...
- [算法考研笔记]mm算法随笔[成绩划分][回溯0-1][得分][字段和][聪明小偷][股票买卖]
mm算法随笔 学习笔记(回溯算法) 回溯 <---->递归1.递归的下面就是回溯的过程 回溯法是一个 纯暴力的 搜索.有的时候暴力求解都没有办法,用回溯可以解决. 回溯法解决的问题: 组合 ...
- 数据仓库主流开发语言——SQL
数仓开发语言概述 SQL语言介绍 数仓与SQL 结构化数据 二维表结构 SQL语法分类
- lca(数链剖分)板子
#include<bits/stdc++.h> #define endl '\n' #define int long long using namespace std; const int ...
- 使用容器快速在阿里云 ECS 多节点上搭建 Citus 12.1 集群
阿里云 ECS 机器节点 这里我们使用两台同一区域的 ECS 机器. 机器配置:2 核 2 G.(ps: 阿里云 99 元一年的活动) 一台安装 coordinator(协调器),这里内网 IP 为 ...
- ElasticSearch之cat recovery API
命令样例如下: curl -X GET "https://localhost:9200/_cat/recovery?v=true&pretty" --cacert $ES_ ...
- markdown中插入视频前台渲染出来导致<video>等标签被转义成字符
markdown中插入视频前台渲染出来导致<video>等标签被转义成字符解决办法: 如图: 在markdown里面插入视频,可以按照下面写法,哈哈,虽然很捞,但是还是可以满足的. < ...