SpringBoot 整合 Redis 报错 The URL is not valid for configuring Spring Data Redis

SpringBoot 整合 Redis 报错 The URL is not valid for configuring Spring Data Redis. The scheme ‘null’ is not supported

项目环境:

  • SpringBoot 2.3.7.RELEASE

pom.xml 文件引入的依赖:

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

application.yml 文件配置

spring:
  redis:
    url: 127.0.0.1
    port: 6379
    password: iampw

启动项目报错信息:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-08-19 21:37:45.758 ERROR 9140 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:
# url 对于 Spring Data Redis 无效,不支持 协议 为 null
The URL '127.0.0.1' is not valid for configuring Spring Data Redis. The scheme 'null' is not supported.

Action:
# 使用不安全的协议 redis:// 或者使用安全的协议 rediss://
Use the scheme 'redis://` for insecure or `rediss://` for secure Redis standalone configuration.

解决

修改 yml 文件,使用redis 的 url 协议

spring:
  redis:
    url: redis://iampw@127.0.0.1:6379
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值