- SpringBoot版本
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>3.1.2</version> </parent>
- 导入spring-boot-stater-data-redis依赖
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency>
- 不生效的配置
报错spring: redis: host: 192.168.40.133 port: 6379
连接的是localhost,说明配置文件没有生效Caused by: io.lettuce.core.RedisConnectionException: Unable to connect to localhost/<unresolved>:6379
- 修改后的正确配置
spring: data: redis: host: 192.168.40.133 port: 6379
问题解决!
标签:redis,SpringBoot,配置文件,spring,boot,data From: https://www.cnblogs.com/ydw333/p/18264143