6

spring boot | spring-boot-starter-data-redis

 1 year ago
source link: https://benpaodewoniu.github.io/2023/01/30/spring42/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

spring boot | spring-boot-starter-data-redis | 犀牛的博客

姑苏城外一茅屋,万树梅花月满天

引入依赖。

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>

常规配置如下: 在 application.yml 配置文件中配置 redis 的连接信息

spring:
redis:
host: localhost
port: 6379
password: 123456
database: 0

如果使用的是集群,那么使用如下配置方式:

spring:
redis:
password: 123456
cluster:
nodes: 10.255.144.115:7001,10.255.144.115:7002,10.255.144.115:7003,10.255.144.115:7004,10.255.144.115:7005,10.255.144.115:7006
max-redirects: 3

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK