redisson icon indicating copy to clipboard operation
redisson copied to clipboard

RedissonAutoConfiguration fails to convert nodes in Native Image (GraalVM) application

Open edudar-chwy opened this issue 1 year ago • 1 comments

Redis version

7.2.4

Redisson version

3.52.0

Redisson configuration

Standard Spring config:

spring:
  data:
    redis:
      cluster:
        nodes: [127.0.0.1:6379]

What is the Expected behavior?

No response

What is the Actual behavior?

convertNodes(String prefix, List<Object> nodesObject) in the auto configuration class takes nodes as List<Object> even though in both places it's invoked from, it's the List<RedisConnectionDetails.Node>.

The rationale behind this might be multi-version support, but it was added in #5273 for Spring Boot 3.1, which had the same record Node(String host, int port) since its introduction.

But because of that, it tries to use reflection over the class and get host and port fields, and fails at runtime when running as a GraalVM native image executable:

Caused by: java.lang.NullPointerException
	at org.springframework.util.ReflectionUtils.makeAccessible(ReflectionUtils.java:800)
	at org.redisson.spring.starter.RedissonAutoConfiguration.convertNodes(RedissonAutoConfiguration.java:384)
	at org.redisson.spring.starter.RedissonAutoConfiguration.redisson(RedissonAutoConfiguration.java:279)
	at org.redisson.spring.starter.RedissonAutoConfigurationV2__BeanDefinitions.lambda$getRedissonInstanceSupplier$0(RedissonAutoConfigurationV2__BeanDefinitions.java:137)

A workaround would be to create a custom RedissonClient tailored to my needs, without using reflection, etc., but this somewhat defeats the purpose of auto-configuration. Unless I'm missing something, accepting List<Node> and returning node.host + ":" + node.port should be enough.

Additional information

No response

edudar-chwy avatar Oct 23 '25 03:10 edudar-chwy

I'll work on this issue.

GaoSSR avatar Dec 31 '25 16:12 GaoSSR