io.lettuce.core.RedisCommandException Exception:“NOAUTH Authentication required”
在某行工作,项目上线代码,uat环境无异常,上到pp环境有问题,报redis连接不上;
观察配置,发觉是apollo的配置是哨兵模式,有个哨兵密码。spring2.2.6RELEASE版本问题。于是写了全局配置,读取配置中的sentinel.password
package com.yupi.springbootinit.config;
import cn.hutool.core.lang.Assert;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configur