一、创建项目并导入依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis-reactive</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
注:新版的redis远程访问时必须要导入security否则会出现错误
二、相关配置
application.properies
spring.redis.port=6379
spring.redis.host=192.168.21.130
spring.redis.password=fernfei
#选第一个库
spring.redis.database=0
注:security访问时需要登陆,默认用户名user,密码在启动时的控制台