@Configuration
public class RedisConfig {
@Value("${spring.redis.host}")
private String redisHost;
@Value("${spring.redis.port}")
private Integer redisPort;
@Value("${spring.redis.password}")
private String redisPassword;
@Bean
@ConfigurationProperties(prefix = "spring.redis")
JedisConnectionFactory jedisConnectionFactory() {
RedisStandaloneConfiguration configuration = new RedisStandaloneConfiguration();
configuration.setHostName(redisHost);
configuration.setPort(redisPort);
configuration.setPassword(redisPassword);
return new JedisConnectionFactory(configuration);
}
}
SpringBoot 2.0 整合 redis 报错:NOAUTH Authentication required
最新推荐文章于 2024-05-05 13:42:56 发布
关键词由CSDN通过智能技术生成