SpringBoot整合Redis—RedisTemplate
Spring Boot 整合Redis (一) spring-boot-starter-data-redis
SpringBoot 使用Spring Data Redis 这个框架来操作Redis
1、创建SpringBoot工程, 添加依赖
添加依赖:spring-boot-starter-data-redis
<!--SpringBoot依赖-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-parent</artifactId>
<version>2.2.2.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!-- SpringBoot默认通过客户端来操作Redis,
所以我们需要引入连接池commons-pool2-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
<!--lombok依赖能简化实体类的开发 -->
<dependency>
<groupId>org.projectlombok</groupId