前言
本文主要记录SpringBoot中集成的Redis的配置类
一、引入起步依赖
代码示例
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
二、RedisConfig配置类
1.RedisConfig
代码如下(示例):
package com.lp.framework.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org

本文介绍了如何在SpringBoot项目中集成Redis,并提供了详细的配置类示例,包括添加起步依赖和自定义RedisTemplate的配置。配置中使用了FastJson2JsonRedisSerializer进行对象的序列化和反序列化,确保数据存储和读取的正确性。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



