赞
踩
真是贵了▄█▀█●
报错信息:
2023-03-31 09:43:58.786 ERROR 1522 --- [nio-8081-exec-1] com.hmdp.config.WebExceptionAdvice : org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379
org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379
报错连不上Redis,匪夷所思的是我用控制台没毛病
我启动别的项目,Redis也没有问题,由此可见,是我这个项目配置出了问题
application.yaml配置
server: port: 8081 spring: application: name: hmdp datasource: driver-class-name: com.mysql.jdbc.Driver url: jdbc:mysql://127.0.0.1:3306/hmdp?useSSL=false&serverTimezone=UTC username: root password: root redis: host: 127.0.0.1 port: 6379 password: 123321 lettuce: pool: max-active: 10 max-idle: 10 min-idle: 1 time-between-eviction-runs: 10s jackson: default-property-inclusion: non_null # JSON处理时忽略非空字段 mybatis-plus: type-aliases-package: com.hmdp.entity # 别名扫描包 logging: level: com.hmdp: debug
但看这个配置,我认为配置的很好,没有问题,我把别的项目Redis配置复制到这个项目,然后就可以了
server: port: 8081 spring: application: name: hmdp datasource: driver-class-name: com.mysql.jdbc.Driver url: jdbc:mysql://127.0.0.1:3306/hmdp?useSSL=false&serverTimezone=UTC username: root password: root redis: host: 127.0.0.1 port: 6379 password: 123321 lettuce: pool: max-active: 10 max-idle: 10 min-idle: 1 time-between-eviction-runs: 10s jackson: default-property-inclusion: non_null # JSON处理时忽略非空字段 mybatis-plus: type-aliases-package: com.hmdp.entity # 别名扫描包 logging: level: com.hmdp: debug
综上所述是缩进空格的原因
▄█▀█●
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。