Skip to content

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

@edudar-chwy

Description

@edudar-chwy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions