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.dataproduces 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.ANNOTATEDexplicitly - 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?
both scenariosyou mean this breakes after a restart? or it can happen runtime also? A good option is to track and debug the piece of code that creates the mapping against any discovered entity / service, to cross check that you dont have a library mismatch there - AntJavaDevorg.springframework.data.repository.core.support.RepositoryFactoryInformation's being found and that should be the case for all four repositories in both scenarios. Library mismatch/conflict came to my mind too, but it seems to me that only spring data related dependencies are involved here, all managed via starter dependencies without any specific versions. - wjans@EntityScan). - wjans