spring-projects / spring-projects/spring-data-rest
Custom repository implementation is not exposed as REST endpoint after upgrade from 4.x to 5.x
@odrotbohm is already working on this.
Since Mar 23, 2026.
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
Given a simple REST exposed repository with a custom fragment
@Entity
class Item {
@Id
@GeneratedValue(strategy = GenerationType.UUID)
var id: UUID? = null
lateinit var value: String
}
interface SearchRepository {
fun fragment(): Iterable<Item>
}
class SearchRepositoryImpl : SearchRepository {
override fun fragment(): Iterable<Item> {
return emptyList()
}
}
@RepositoryRestResource
interface EntityRepository : Repository<Item, UUID>, SearchRepository {
fun findAll(): Iterable<Item>
}
With Spring Boot 3 which uses Spring Data REST 4 the following response is returned if request the (generated) /{repository}/search` endpoint:
{
"_links" : {
"fragment" : {
"href" : "https://example.com/items/search/fragment"
},
"self" : {
"href" : "https://example.com/items/search"
}
}
}
But after update to Spring Boot 4 which uses Spring Data REST 5 the endpoint can not be found anymore. Also the main repository endpoint /{repository} lost the search link:
{
"_embedded" : {
"items" : [ ]
},
"_links" : {
"self" : {
"href" : "https://example.com/items"
},
"profile" : {
"href" : "https://example.com/profile/items"
}
}
}
Before update:
{
"_embedded" : {
"items" : [ ]
},
"_links" : {
"self" : {
"href" : "https://example.com/items"
},
"profile" : {
"href" : "https://example.com/profile/items"
},
"search" : {
"href" : "https://example.com/items/search"
}
}
}
A minimal project with test(s) can be found at https://github.com/agebhar1/gh-spring-data-rest-repository-fragment with a branch for Spring Boot 3 w/ Spring Data REST 4 and Spring Boot 4 w/ Spring Data REST 5.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.