Spring Data Rest repositories occasionally not exported

Viewed 289

I'm having a weird issue in my Spring Boot application (2.2.6.RELEASE) using Spring Data Rest (3.2.6.RELEASE). From time to time my repositories are not exposed via rest. This is happening with the exact same version (same jar) of my application using the exact same configuration.

There are 4 @RepositoryRestResource's and when it's working, the root resource exposes this:

{
    "_links": {
        "entity-a": {
            "href": "http://localhost:8080/api/entity-a{?projection}",
            "templated": true
        },
        "entity-b": {
            "href": "http://localhost:8080/api/entity-b"
        },
        "entity-c": {
            "href": "http://localhost:8080/api/entity-c{?page,size,sort,projection}",
            "templated": true
        },
        "entity-d": {
            "href": "http://localhost:8080/api/entity-d"
        },
        "profile": {
            "href": "http://localhost:8080/api/profile"
        }
    }
}

and when it's not working it returns:

{
    "_links": {
        "profile": {
            "href": "http://localhost:8080/api/profile"
        }
    }
}

Some additional findings:

  • The JPA component scan is working in both scenarios
  • The repositories themselves are working cause in both scenarios, custom controllers using these repo's work fine
  • Enabling debug logging for org.springframework.data produces the exact same output in both scenarios
  • Comparing responses from actuator endpoints doesn't show any noticeable difference
  • Repository detection strategy is set to RepositoryDetectionStrategies.ANNOTATED explicitly
  • I cannot reproduce it in a SSCE
  • Module has been upgraded from Spring Boot 1.5.18, the issue started happening after the upgrade.

Has anybody else experienced this issue before? What might be causing this? Or some pointers on how I can further analyse this problem?

1 Answers

Sounds like you're running into DATAREST-1502 which has been fixed in 3.2.7 and newer.

Related