Skip to content

@RedisHash is returning null elements for CrudRepository.findAll() in different Spring Boot Microservices  #2114

@KaisNeffati

Description

@KaisNeffati

Hello there Spring team,

I ve been struggling for a couple of days to find a solution for a problem am facing. I searched through the net and i was really exhausted without any results ! Until I found it on stackoverflow in an unsolved question link

So to explain the issue , here is the environment :
Two microservices A and B

Both have dependencies spring boot and spring data redis version 2.3.8.RELEASE

Both have the following Repository and Entity

@Repository
public interface EventRepository  extends CrudRepository<Event, UUID> {
    @Nonnull
    @Override
    List<Event> findAll();
}
@RedisHash("EVENT:DATASET")
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
public class Event {
    private UUID id;
    private NestedEvent data; // NestedEvent : Object with nested Objects
}

Application yml

spring:
  redis:
    host: localhost
    port: 6379
    password: password
    ssl: false
    database: 0

So the scenario is the following :

A : Store a list of Event in Redis (example 100 event)
B : Fetch all events : eventRepository.findAll()
Result : List of nulls (example 100 null element)

The Fixe i made was to extract a lib and make sure the entity Event is always in the same package.
TypeAlias("EVENT"): Do nothing

Please fixe the issue
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions