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
41
votes
7 answers
Are there any big spring-boot open source projects?
I'm currently developing a spring boot application and would like to see some kind of real-world examples of how big spring boot projects can be architectured. I've tried searching the web myself, but had no success so far.
I would be especially…

tuesday
- 582
- 1
- 7
- 14
39
votes
15 answers
Expose all IDs when using Spring Data Rest
I'd like to expose all IDs using a Spring Rest interface.
I know that per default an ID like this will not be exposed via the rest interface:
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(unique=true, nullable=false)
…

Baiteman
- 535
- 1
- 4
- 14
39
votes
4 answers
How to maintain bi-directional relationships with Spring Data REST and JPA?
Working with Spring Data REST, if you have a OneToMany or ManyToOne relationship, the PUT operation returns 200 on the "non-owning" entity but does not actually persist the joined resource.
Example Entities:
@Entity(name = 'author')
@ToString
class…

keaplogik
- 2,369
- 2
- 25
- 26
37
votes
1 answer
Why does RestTemplate not bind response representation to PagedResources?
I am using spring-data-rest to expose entities as (paged) rest resources. Everything works fine, but when I request data via RestTemplate, I get an useless HATEOAS JSON (which I didn't ask for). The JSON seems to be a PagedResources. I could live…

user3563584
- 403
- 1
- 4
- 6
35
votes
3 answers
How to disable the default exposure of Spring Data REST repositories?
I have a project that uses spring-data-rest, and has a dependency project that only uses Spring Data. Both projects have spring data repositories and use @EnableJpaRepositories to implement their repository interfaces, but I only want to export the…

gyoder
- 4,530
- 5
- 29
- 37
34
votes
4 answers
Multiple Repositories for the Same Entity in Spring Data Rest
Is it possible to publish two different repositories for the same JPA entity with Spring Data Rest?
I gave the two repositories different paths and rel-names, but only one of the two is available as REST endpoint.
The point why I'm having two…

Gregor
- 2,917
- 5
- 28
- 50
34
votes
2 answers
How to mix spring-data-rest with spring websocket into a single implementation
I'd like to synchronize the state to all the clients interested in particular entity changes. So I'd like to achieve something like:
exposing CRUD API on entity (via HTTP/REST and websockets)
and routing the response (of the modifying calls) to…

Peter Butkovic
- 11,143
- 10
- 57
- 81
33
votes
3 answers
Can Spring Data REST's QueryDSL integration be used to perform more complex queries?
I'm currently building a REST API in which I want clients to easily filter on most properties of a specific entity. Using QueryDSL in combination with Spring Data REST (an example by Oliver Gierke) allows me to easily get to 90% of what I want by…

Dennis Laumen
- 3,163
- 2
- 21
- 24
32
votes
1 answer
Authentication and authorization in Spring Data REST
I am implementing a Spring Data REST based app and I would like to know if there is an elegant way to implement authentication and authorization rules using this framework or related frameworks.
All HTTP requests to the REST server must carry…

Rodrigo Guerra
- 378
- 1
- 3
- 8
31
votes
5 answers
Jackson @JsonFormat set date with one day less
I have been used Spring Date Rest with Spring Boot in my project.
This project has a object and I have used the annotation @JsonFormat to format the date field that will be received from my Json.
The format of field Date is "dd/MM/yyyy".
When I …

William Miranda
- 493
- 1
- 7
- 13
31
votes
10 answers
How to get old entity value in @HandleBeforeSave event to determine if a property is changed or not?
I'm trying to get the old entity in a @HandleBeforeSave event.
@Component
@RepositoryEventHandler(Customer.class)
public class CustomerEventHandler {
private CustomerRepository customerRepository;
@Autowired
public…

Marcel Overdijk
- 11,041
- 17
- 71
- 110
31
votes
5 answers
HATEOAS client with AngularJS
I was wondering if there were any features hidden in Angular or exposed by some 3rd-party libraries to easily create HATEOAS-compliant Restful clients.
On backend side, I am using Spring Data/REST to produce an HATEOAS JSON API.
Consuming it,…

fbiville
- 8,407
- 7
- 51
- 79
30
votes
3 answers
How to prevent some HTTP methods from being exported from my MongoRepository?
I'm using spring-data-rest and I have a MongoRepository like this:
@RepositoryRestResource
interface MyEntityRepository extends MongoRepository {
}
I would like to allow the GET methods but disable PUT, POST, PATCH and DELETE…

avandecreme
- 971
- 1
- 8
- 18
30
votes
2 answers
Spring Data Rest Without HATEOAS
I really like all the boilerplate code Spring Data Rest writes for you, but I'd rather have just a 'regular?' REST server without all the HATEOAS stuff. The main reason is that I use Dojo Toolkit on the client side, and all of its widgets and…

Matt
- 823
- 1
- 8
- 17
28
votes
4 answers
Spring Data REST: Override repository method on the controller
I have the following REST repository, whose implementation is generated at runtime by Spring.
@RepositoryRestResource
public interface FooRepository extends CrudRepository {
}
This means that I will have save(), find(), exists() and…

Nicolas
- 321
- 2
- 4
- 7