在一个Spring Boot的web项目中加入redis需要什么操作
- 在pom.xml中添加spring-boot-starter-data-redis依赖;
- 在application.properties文件中配置redis的连接信息;
- 创建RedisConfig类,配置redisTemplate和StringRedisTemplate;
- 在需要使用redis的地方注入RedisTemplate或StringRedisTemplate即可使用redis。
原文地址: https://www.cveoy.top/t/topic/bNf6 著作权归作者所有。请勿转载和采集!