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.
Given a simple REST exposed repository with a custom fragment
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.