一)Redis简介
Redis是一个缓存,消息代理和功能丰富的键值存储,NOSQL数据库。
SpringBoot支持的Redis驱动类:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
二)Redis参数配置
必须配置参数:
spring:
redis:
database: 0
url:
host: localhost
password:
port: 6379
timeout: 5000
如需增加其它可选配置,可按照下面步骤查看SpringBoot支持的配置。
第一步:在引入Jar中找到,对应的spring-boot-autoconfigure*.jar包,比如:spring-boot-autoconfigure-2.3.0.RELEASE.jar。
第二步:在Jar包中找到org.springframework.boot.autoconfigure.data.redis包。