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
14
votes
1 answer
How to mix Spring Data Repositories and Spring Rest Controllers
Currently I am exposing a few Spring Data Repositories as RESTful services by annotating them with @RepositoryRestResource like this:
@RepositoryRestResource(collectionResourceRel = "thing1", path = "thing1")
public interface Thing1Repository…

dspiegs
- 548
- 2
- 9
- 24
13
votes
2 answers
Why is the version property not set with Spring Data JPA?
Wanted to know how is @Version annotation in Spring Data REST put to use for ETags, I do not see the ETags populated for some reason
@Entity
@EntityListeners(AuditingEntityListener.class)
public class Venue implements Serializable {
private…

Anadi Misra
- 1,925
- 4
- 39
- 68
13
votes
3 answers
How to add custom methods to Spring Data Rest JPA implementation and leverage HATEOS support?
I have a Spring Data Rest Repository controller that utilizes JPA for the query implementation, and I need to add some custom query methods that cannot be done using the standard queryByExample method that JPA supports. I have created an Impl class…

Marc Zampetti
- 733
- 7
- 20
13
votes
1 answer
Find entities containing a string in a list in Spring Data Repositories
I do have a simple MongoRepository and its entities do have a List tags attribute. Is there a way to add a findBy method to the repository? Something like
List<...> findByInTags(@Param("tag") String tag);
So all entities containing the…

alexvetter
- 1,998
- 2
- 16
- 42
13
votes
5 answers
Not found in annotated query error with @Query
I am using spring data with REST. I have a table country and an Entity corresponding to it called Country.java
I have annotated my method in CountryRepositopry as
public interface CountryRepository extends Repository {
…

Vijay Kumar Rajput
- 1,071
- 1
- 10
- 30
13
votes
3 answers
Spring Data REST custom query integration
I want to create a REST link for an Employee entity that will basically be a findByAllFields query. Of course this should be combined with Page and Sort. In order to do that I have implemented the following code:
@Entity
public class Employee…

ChrisGeo
- 3,807
- 13
- 54
- 92
13
votes
4 answers
Different JSON output when using custom json serializer in Spring Data Rest
After adding a custom Jackson serializer based on the official documenation I've observed a slightly different json output format.
This example is based on spring-restbucks.
Extend org.springsource.restbucks.WebConfiguration from…

ksokol
- 8,035
- 3
- 43
- 56
12
votes
2 answers
What are the differences of using service pattern and using standalone repository Spring Data REST?
What are the differences of using Spring Data REST repository alone and implementing the “service” pattern around it (that is ItemService, ItemServiceImpl and so on)?
At the first glance the functionality is more or less the same with the difference…

kwojcikowski
- 153
- 1
- 9
12
votes
4 answers
Spring Data REST Custom Resource URI works for String but not Long
I have a model:
public class MyModel {
@Id private Long id;
private Long externalId;
// Getters, setters
}
I'd like to use externalId as my resource identifier:
@Configuration
static class RepositoryEntityLookupConfig extends…

rizjoj
- 197
- 2
- 9
12
votes
2 answers
Spring data rest sorting fields with underscores
We are using a very simple setup of @RepositoryRestResource on top of a PagingAndSortingRepository connected to a postgres database. Also we have configured spring.jackson.property-naming-strategy=SNAKE_CASE to return pretty json. It was all fine…

Rince
- 2,195
- 3
- 21
- 35
12
votes
2 answers
How to expose the resourceId with Spring Data Rest
I had was to expose the primary key which is annotated with @Id in entity.the ID field is only visible on the resource path, but not on the JSON body.

Chandra
- 1,722
- 16
- 19
12
votes
4 answers
spring.data.rest.max-page-size does not seem to be working
Under Spring Boot 1.3.0.M5 I'm using
spring.data.rest.max-page-size=10
in application.properties.
But I still can set the size to 40 in a URL and get a correct response.
For example…

Gauthier Peel
- 1,438
- 2
- 17
- 35
12
votes
1 answer
Spring Data Rest PagingAndSortingRepository AbstractMethodError (RepositoryFactorySupport)
I'm trying to buil an Rest Api using Spring Data Rest, after to change my pom.xml many times to find the compatible dependencies to my project, I have this problem now:
java.lang.AbstractMethodError:…

Rosendo Ropher
- 496
- 8
- 21
12
votes
3 answers
Enable HAL serialization in Spring Boot for custom controller method
I'm trying to build a RESTful API with Spring Boot using spring-boot-starter-data-rest. There are some entities: accounts, transactions, categories and users - just the usual stuff.
When I retrieve the objects at http://localhost:8080/transactions…

Tilman
- 925
- 1
- 8
- 18
12
votes
4 answers
How to disable paging for JpaRepository in spring-data-rest
I'm using spring-data-rest with JpaRepository to create the Rest-Endpoints. By default, paging is enabled for all JpaRepository, what is a good thing. But I have a legacy application that we port to our new stack that does not support paging. I…

Micha Reiser
- 201
- 1
- 2
- 6