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

整合过程:

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. windows server 2019 2012 server 2022 无线网卡驱动安装报错,无线网卡驱动不能安装, inf服务安装段落无效

    windows server 2019 无线网络 服务安装段落无效 windows server 2019 无线网卡驱动安装报错,无线网卡驱动不能安装, inf服务安装段落无效 indows serv ...

  2. Postgres 和 MySQL 应该怎么选?

    PostgreSQL和MySQL是两个流行的关系型数据库管理系统(DBMS).它们都具有一些相似的功能,但也有一些区别. 在选择使用哪个DBMS时,需要考虑多个因素,包括性能.可扩展性.安全性.功能丰 ...

  3. HTTPClients使用

    一. 创建httpclient对象用于发送get.post等请求 1. HttpClients.custom()的方式--自定义httpclient对象,多用于含有cookie的请求 1. Cooki ...

  4. [NOI online22提高A] 丹钓战

    题目描述 有 \(n\) 个二元组 \((a_i, b_i)\),编号为 1 到 n. 有一个初始为空的栈 SS,向其中加入元素 \((a_i, b_i)\) 时,先不断弹出栈顶元素直至栈空或栈顶元素 ...

  5. [USACO2007NOVG] Cow Relays G

    题目描述 For their physical fitness program, N (2 ≤ N ≤ 1,000,000) cows have decided to run a relay race ...

  6. Oracle-startup和shutdown

    startup不同参数作用 startup nomount 非安装启动,以这种方式启动可执行: 1.重建控制文件. 2.重建数据库读取init.ora文件. 3.启动实例,即启动SGA和后台进程,需要 ...

  7. 华企盾DSC客户端无法连接以及无法切换工作模式常见处理方法

    先查看客户端日志见文档<客户端连接服务器问题和加密进程初步判断>常见的 1.检查客户端连接服务器配置是否正确 2.telnet服务器的IP和端口是否通 3.客户端日志中显示client i ...

  8. 基于python的cat1模块的AT指令串口通信解析

    一 前记 使用cat1模块做产品的过程中,遇到了不少问题.其中很重要的一个就是怎么测试单个模块的好坏.这里笔者专门写了一个工具,来测试cat1模块的是否好用,这里做一个分享吧.   二 源码解析 这个 ...

  9. C realloc(): invalid next size错误

    C realloc(): invalid next size 问题代码 #include <stdio.h> #include <stdlib.h> int *getNumbe ...

  10. 【wing】一款轻量快捷的团队开发工具

    导航 开源地址:[Github] & [Gitee] 新手使用 更多命令 开发指南 说明 wing是一个代码同步管理工具类似repo,具有以下特性: 支持Winddows .Linux .Ma ...