题目
在Spring Boot整合Redis缓存时,若要在项目中使用Redis作为缓存,需要在 pom. xml文件中添加的依赖是( ) A. spring-boot-starter-cacheB. spring-boot-starter-data-redisC. redis. clients. jedis. JedisD. org. springframework. data. redis. Redis Template
在Spring Boot整合Redis缓存时,若要在项目中使用Redis作为缓存,需要在 pom. xml文件中添加的依赖是( )
- A. spring-boot-starter-cache
- B. spring-boot-starter-data-redis
- C. redis. clients. jedis. Jedis
- D. org. springframework. data. redis. Redis Template
题目解答
答案
B
解析
在Spring Boot项目中,要使用Redis作为缓存,需要添加相应的依赖。`spring-boot-starter-cache`是Spring Boot提供的缓存支持的启动器,它可以帮助我们快速地集成缓存功能。而`spring-boot-starter-data-redis`则是Spring Boot提供的Redis数据访问的启动器,它包含了对Redis的连接和操作的支持。因此,要使用Redis作为缓存,需要添加`spring-boot-starter-data-redis`依赖。