当前位置: 首页> 汽车> 新车 > 分享信息的网站_建设银行网络平台_地推接单网_微信小程序平台官网

分享信息的网站_建设银行网络平台_地推接单网_微信小程序平台官网

时间:2025/7/8 16:51:48来源:https://blog.csdn.net/bailichun19901111/article/details/146425923 浏览次数: 2次
分享信息的网站_建设银行网络平台_地推接单网_微信小程序平台官网

报错信息:

io.lettuce.core.RedisCommandExecutionException: NOAUTH Authentication required.

Redis密码配置确认无误,但是只要使用Redis存储就报这个异常。很可能是因为配置的spring.redis.password没有被读取到。



基本依赖:

implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-security'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
// redis
implementation 'org.springframework.boot:spring-boot-starter-data-redis'

基本设置(application.properties):

spring.redis.host=127.0.0.1
spring.redis.port=6379
spring.redis.password=your_password
spring.redis.database=0
spring.redis.timeout=3000


解决方法:

@Configuration
public class RedisConfig {@Value("${spring.redis.password}")private String redisPassword;@Value("${spring.redis.host}")private String redisHost;@Value("${spring.redis.port}")private int redisPort;/*** 解决redis认证报错问题:io.lettuce.core.RedisCommandExecutionException: NOAUTH Authentication required.** @return*/@Beanpublic LettuceConnectionFactory redisConnectionFactory() {return new LettuceConnectionFactory(new RedisStandaloneConfiguration(redisHost, redisPort) {{setPassword(RedisPassword.of(redisPassword));}});}
}
关键字:分享信息的网站_建设银行网络平台_地推接单网_微信小程序平台官网

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: