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

整合过程:

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. 最小的k个数 (3.20 leetcode每日打卡)

    输入整数数组 arr ,找出其中最小的 k 个数.例如,输入4.5.1.6.2.7.3.8这8个数字,则最小的4个数字是1.2.3.4. 示例 1: 输入:arr = [3,2,1], k = 2 输 ...

  2. AcWing 190. 字串变换

    原题连接:AcWing 190. 字串变换 题意: 已知有两个字串 \(A, B\) 及一组字串变换的规则(至多 \(6\) 个规则): \(A_1→B_1\) \(A_2→B_2\) \(-\) 规 ...

  3. MySQL-mysqldump 报错:[ERROR] unknown variable 'local_infile=1'.

    版权声明:原创作品,谢绝转载!否则将追究法律责任. ----- 作者:kirin mysqldump: [ERROR] unknown variable 'local_infile=1'. 解决方法: ...

  4. Docker-Compose部署Gitlab以及Gitlab配置SMTP邮件服务

    使用Docker-Compose部署Gitlab 拉取镜像 地址: https://hub.docker.com/r/gitlab/gitlab-ce/tags 拉取到镜像后,使用docker tag ...

  5. 基于win11的Emby、Playnite搭建家庭影音娱乐方案

    0. 概述 0.1 Emby效果 0.2 playnite效果 0.3 软件清单及教程 流媒体:Emby (分Server端.安卓端.安卓TV端.iOS端,PC最好使用网页端) 电影/电视剧/动画:找 ...

  6. 将mysql的输出文本写回mysql

    1 准备工作 1.1 环境准备 操作系统:Microsoft Windows 10 专业工作站版 软件版本:Python 3.9.6 第三方包: pip install pandas2.1.0 pip ...

  7. 流畅的orm让我发现我抵触的是mybatis而不是java

    流畅的orm让我发现我抵触的是mybatis而不是java 背景介绍 开发.net 也快10年了,到第三年的时候我已经渐渐瓶颈了,于是我在网上找各种资料但是大部分c#资料全是皮毛资料,稍微深一点点就再 ...

  8. flask蓝图(这玩意就是django的子应用)

    蓝图的概念类似django的子应用,作用就是分模块开发,有关联的都放在一起. 蓝图的创建步骤: 新建一个包(一个包就是一个模块.等同于一个子应用) 在包的__init__.py中创建蓝图对象 . 蓝图 ...

  9. 华企盾DSC服务器无法启动常见处理方法

    先查看<服务问题判断>文档.常见的 1.授权已经过期--需延长授权 2.ERR_BASE64 – 机器码变更 3.不能在该计算机上使用该数据库,需要解锁才可以--打开服务器配置解锁数据库 ...

  10. CVE-2022-39197 复现

    CVE-2022-39197 ️漏洞介绍 Cobalt Strike (CS) 是一个为对手模拟和红队行动而设计的平台,相当于增强版的Armitage,早期以Metasploit为基础框架,3.0版本 ...