Spring Data REST (SDR) is a Spring Data project that aims to make it easy to expose Spring Data repositories as REST services. SDR use Spring HATEOAS internally to create HAL response.
Questions tagged [spring-data-rest]
2228 questions
18
votes
3 answers
How to configure Spring TestRestTemplate
I have a REST (spring-hateoas) server that I'd like to test with a JUnit test. Therefore I am using an autoinjected TestRestTemplate.
But how do I now add some more configuration to this pre configured TestRestTemplate? I need to configure the…

Robert
- 1,579
- 1
- 21
- 36
18
votes
2 answers
Spring Data Rest controllers: behaviour and usage of @BasePathAwareController, @RepositoryRestController, @Controller and @RestController
I'm trying to understand the exact behaviour of the Spring Data Rest Controllers.
I have made a simple implementation to test 4 kinds of annotated controllers: @BasePathAwareController, @RepositoryRestController, @RestController, @Controller
The…

Alessandro C
- 3,310
- 9
- 46
- 82
18
votes
2 answers
Exclude some fields of Spring-data-rest resource
I'm trying to use Spring-data-rest with spring-data-mongodb to expose read-only resources.
The problem I met, is that I want to have different views of my documents.
Let's say I have some private information in a document, I don't want to expose…

Hugo Lassiège
- 986
- 1
- 11
- 26
18
votes
1 answer
Using Spring Security ACL with Spring Data REST
I am trying to authorize apis exposed by Spring Data REST. So far I am able to do role-based authorization i.e:
@RepositoryRestResource(path = "book")
public interface BookRepository extends JpaRepository {
…

charybr
- 1,888
- 24
- 29
17
votes
1 answer
Spring Data REST - collectionResourceRel vs path
I'm using Spring Data REST. RepositoryRestResource annotation has two different fields: path and collectionResourceRel. What's the difference between those two? I can't figure this out by reading the documentation.
path is described:
The path…

k13i
- 4,011
- 3
- 35
- 63
17
votes
1 answer
Is there a generic REST query language for JPA, spring-data, spring-data-rest
Requirements
generic query language that can be used in GET requests to collection resources in REST api to filter the set of resources returned
queries passed in via a "standard" query language and sent over HTTP as request parameter(s) - .e.g …

Nathan Coast
- 171
- 1
- 8
17
votes
2 answers
Spring Data REST - PUT request does not work properly since v.2.5.7
Since version 2.5.7 Spring Data REST does not properly perform a PUT request to update resource which has associated resources. Unlike PATCH request that works as expected!
For example, Person has a many-to-one association with Addres. If we perform…

Cepr0
- 28,144
- 8
- 75
- 101
17
votes
2 answers
Spring Boot integration test ignoring secure=false in AutoConfigureMockMvc annotation, get 401
Can't make my @SpringBootTest work. It says authentication is on, which I do not want.
I've set it up with @AutoConfigureMockMvc(secure = false)
I submit a mock request with some JSON and my integration test should test the whole stack, taking it…

Adam
- 5,215
- 5
- 51
- 90
17
votes
4 answers
Spring Data Rest - sort by nested property
I have a database service using Spring Boot 1.5.1 and Spring Data Rest. I am storing my entities in a MySQL database, and accessing them over REST using Spring's PagingAndSortingRepository. I found this which states that sorting by nested parameters…

Kasra Ferdowsi
- 574
- 5
- 16
17
votes
4 answers
Swagger not detecting Spring Data Rest APIs with Spring Boot
I setup a Spring Boot project including Spring Data Rest and Swagger:
org.springframework.boot
spring-boot-starter-data-rest
…

Manu
- 4,019
- 8
- 50
- 94
17
votes
3 answers
How to build a dynamic URL in Spring MVC?
I am trying to send one URL which I will generate on basis of some dynamic value. But I don't want to hard code it nor want to use response or request object.
Example:
http://localhost:8585/app/image/{id}/{publicUrl}/{filename}
So I want to get…

John Maclein
- 1,034
- 3
- 13
- 24
17
votes
2 answers
Spring Data Rest: RepositoryEventHandler methods not invoked
I am trying to add a RepositoryEventHandler as described on Spring Data REST documentation to the REST repository shown below:
@RepositoryRestResource(collectionResourceRel = "agents", path = "/agents")
public interface AgentRepository extends…

dimi
- 1,496
- 2
- 15
- 27
16
votes
1 answer
Post an entity with Spring Data REST which has relations
I'm using Spring Data Rest. I have a problem trying to POST an object with association(e.g. address is a field in my entity that is mapped as many to one).
The question is, what format should we use to connect our new entity with its relations. I…

dvelopp
- 4,095
- 3
- 31
- 57
16
votes
1 answer
POSTing nested objects using spring data rest?
I have recently started using spring-data-rest for my application. I have the following JPA entities:
@Entity
public class Super {
@Id
private long id;
@JoinTable
@OneToMany(cascade = CascadeType.ALL)
private List…

Devashish Dixit
- 1,153
- 6
- 16
- 25
16
votes
3 answers
Spring Data REST How to add embedded resources inline
I'm using Spring Data REST and Hateoas in combination with HAL browser. This works perfectly, but now I would like to make a JSON dump of a specific entity with (a set of) its associated objects. I used @Projection but then I got stuck again.
FYI:…

codesmith
- 1,381
- 3
- 20
- 42