-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Redis standalone can't use application.properties to change Redis configuration #2914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If you would like us to spend some time helping you to diagnose the problem, please spend some time describing it and, ideally, providing a minimal yet complete sample that reproduces the problem. |
This is my redis configuration class @Configuration
class MyConfig {
@Bean
LettuceConnectionFactory connectionFactory() {
return new LettuceConnectionFactory();
}
@Bean
ReactiveRedisTemplate<String, String> ReactiveRedisTemplate(ReactoveRedisConnectionFactory connectionFactory) {
return new ReactiveRedisTemplate<>(connectionFactory, RedisSerializationContext.string());
}
} This is my project maven environment <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis-reactive</artifactId>
</dependency>
</dependencies> And I configured the host,password&port in application.properties spring.data.redis.host=xxx.com
spring.data.redis.port=14777
spring.data.redis.password=xxxxx Then I wrote a test case intending to pass a list data to my Redis remote server @Qualifier("ReactiveRedisTemplate")
@Autowired
private ReactiveRedisOperations<String, String> operations;
public Mono<Long> addLink(String userId, String url) {
return operations.opsForList().leftPush(userId, url);
}
@Test
void testA() {
Mono<Long> mono = addLink("tks1", "http://google.com");
log.info("mono: {}", mono.block());
} And then an error.The error message is as follows:
But I can connect to the Redis server by way of RedisStandaloneConfiguration: @Configuration
class MyConfig {
@Bean
LettuceConnectionFactory connectionFactory() {
RedisStandaloneConfiguration serverConfig = new RedisStandaloneConfiguration("xxx.com", 14777);
serverConfig.setPassword("xxxxx");
return new LettuceConnectionFactory(serverConfig, clientConfig);
}
@Bean
ReactiveRedisTemplate<String, String> ReactiveRedisTemplate(ReactoveRedisConnectionFactory connectionFactory) {
return new ReactiveRedisTemplate<>(connectionFactory, RedisSerializationContext.string());
}
} Then the data was uploaded successfully
So, spring-boot-starter-data-redis with version 3.2.5 unable to configure Redis startup configurations by modifying configuration files such as application.properties? |
Hello, I'm having the same issue. I did what @UnfetteredCodeMan mentions to solved my problem, using the application.properties doesn't work at all. In my case, I use spring boot 3.3.0 and redisStandalone. |
Hi, I've encountered the same issue using Spring Boot 3.4.5. I tried both
|
Can't change the Redis startup port by modifying the application.properties's host,port,password when using RedisTemplate on Redis standalone.


But I can connect to the Redis server by way of RedisStandaloneConfiguration

So is spring-boot-starter-data-redis with version 3.2.5 unable to configure Redis startup configurations by modifying configuration files such as application.properties?
The text was updated successfully, but these errors were encountered: