备忘 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 按照你电脑系统来 ...
- C语言计算并输出华氏温度为80F所对应的摄氏温度C。转换公式为:C=5*(F-32)/9
#include <stdio.h> int main() { double F = 80.0, C;//定义摄氏温度变量,赋值华氏温度 C = 5 * (F - 32) / 9.0;// ...
- 微信小程序文件预览和下载-文件系统
文件预览和下载 在下载之前,我们得先调用接口获取文件下载的url 然后通过wx.downloadFile将下载文件资源到本地 wx.downloadFile({ url: res.data.url, ...
- 【Android】打卡app 今日完成情况记录
已完成内容:页面的设计.数据库的建立 今日目标:实现数据库的增删改查,并能够在页面实现输出 逻辑: 1.用户进入注册页面,进行注册,注册成功后,可以成功登录(这一阶段就完成了) 2.登录后,显示用户的 ...
- SpringBoot进阶教程(七十八)邮件服务
Sun公司提供了JavaMail用来实现邮件发送,但是配置烦琐,Spring中提供了JavaMailSender用来简化邮件配置,Spring Boot则提供了MailSenderAutoConfig ...
- Net 高级调试之十一:托管堆布局架构和对象分配机制
一.简介 今天是<Net 高级调试>的第十一篇文章,这篇文章来的有点晚,因为,最近比较忙,就没时间写文章了.现在终于有点时间,继续开始我们这个系列.这篇文章我们主要介绍托管堆的架构,对象的 ...
- 用EXCEL VBA 做的学生成绩分析系统
标题:基于EXCEL VBA的学生成绩分析系统--详细介绍与说明导言:学生成绩分析对于教育机构和学生个体来说具有重要意义.本文将详细介绍基于EXCEL VBA的学生成绩分析系统的设计与实现.通过该系统 ...
- Echarts图表基本参数设置说明
ECharts 是一款强大的数据可视化库,可以通过 JavaScript 构建交互式和动态的图表.在使用 ECharts 进行图表绘制时,我们可以通过设置各种参数来达到我们想要的效果.下面是对 ECh ...
- Spring中Bean的加载方式~
1.方式一:基于spring.xml方式配置Bean user import lombok.Data; /** * @author : ly */ @Data public class User { ...
- django-celery-beat插件使用
该插件从 Django 管理界面管理celery的定期任务,您可以在其中动态****创建.编辑和删除定期任务以及它们的运行频率. django-celery-beat提供了几种添加定时或周期性任务的方 ...