Search code examples
javaspring-dataspring-sessionspring-data-redislettuce

Spring Session 2.0 Redis Lettuce Configuration


I'm attempting to integration Spring Session 2.0 w/ Redis into a spring framework webapp, but I'm getting caught on configuring the LettuceConnectionFactory. I need to configure it to use SSL, and Spring's documentation here shows configuration like this:

LettuceClientConfiguration clientConfig = LettuceClientConfiguration.builder()
.useSsl().and()
.commandTimeout(Duration.ofSeconds(2))
.shutdownTimeout(Duration.ZERO)
.build();

However, the javadoc for LettuceClientConfigurationBuilder here shows that the .useSsl() method actually returns a LettuceSslClientConfiguration (javadoc) and that has zero methods on it, and the LettuceConnectionFactory doesn't even accept it as a parameter (javadoc).

I'm wondering if this is a lapse in the api for Spring Data 2.0, but I can't find any bug reports. Any help is appreciated. I've tried to scour all their documentation, but it's very possible I missed something. Thanks!


Solution

  • That's a bug which is going to be fixed with DATAREDIS-755.

    With Spring Data Redis 2.0 we introduced immutable configuration objects to LettuceConnectionFactory. This change does not break existing functionality. That said, continue to use the deprecated methods until it's shipped.

    If you don't use LettuceClientConfiguration you there's no difference in behavior. If you use the new configuration object LettuceClientConfiguration and then call a deprecated setter method, this will raise an exception.