Add guide on configuring port and hostname
harryge00 opened this issue · 6 comments
I am not familiar with spring framework. I tried to use setHostname/setPort
or RedisStandaloneConfiguration
to configure host/port, but it always reported error ...
I think as guide for spring, it will be beneficial adding example on configuring host/port instead of using the default config. Thanks
I think we shouldn't change the heading, but I also think it's a reasonable request to add how to set the host and port. Thanks for the feedback, @harryge00
Gary: If you're not the right person to describe that, please let me know. Also, if you want help with the wording, please let me know. I'll review it anyway, though. Thanks much.
I am not the right person (@mp911de , or someone from the Boot team?).
However, I would suggest a doc link to https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-redis and to https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html#data-properties (scroll down to spring.redis.host
).
I have an open request to make the anchors for those properties more granular. It's not getting much love. Vote it up!!
+1 for a doc link. And the same for rabbit and Kafka guides.
I finally figured out a way to configure 😂:
# Add another function:
@Bean
public RedisConnectionFactory redisConnectionFactory() {
RedisStandaloneConfiguration redisConfig = new RedisStandaloneConfiguration("1.2.3.4", 6379);
redisConfig.setPassword(RedisPassword.of("somepassword"));
return new LettuceConnectionFactory(redisConfig);
}
Using application.properties
would be more elegant though. Thanks for your reply.
RedisConnectionFactory
is configured by Spring Boot, so +1 to add a link to the Boot docs that explain Redis properties related to the endpoint configuration.