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
0
votes
0 answers
Fallback for Spring Data REST link generation when no current request is available
I have a spring-data-rest & spring-hateoas app powering a UI that depends heavily on the presence of the _links field in all responses. This has been working well. However I have a need to serialize response models out-of-band of any request (during…

sonicrocketman
- 31
- 3
0
votes
1 answer
Spring Data Rest - Post Request failing with Null Pointer Foreign Key Exception
I am having a Spring Data rest API where I am trying to save a new record in Entity named comment.
This entity has a many to one relationship with another entity named department.
When I call the post api for this entity , I am getting below null…

Saimuga
- 255
- 1
- 5
- 16
0
votes
0 answers
Is it possible to have spring controller directly map a URI to entity?
I use the framework Spring Data Rest for my API end points and controller.
I want to take in an URI to an entity and have spring convert it automatically
For many years the way I've been doing it this way
@PostMapping(value =…

erotsppa
- 14,248
- 33
- 123
- 181
0
votes
1 answer
Add link to Spring Data REST Repository resource with RepresentationModelProcess
The Spring Data Rest repository notes that Custom Links can be added to an Entity as below:
https://docs.spring.io/spring-data/rest/docs/current/reference/html/#customizing-sdr.customizing-json-output.adding-links
Example Given:
@Bean
public…
0
votes
0 answers
How to add a parent class without document reference with only common parameters and apply Inheritance concept in Spring boot using MONGO
I have 2 collections in mongodb,
property_report_order
{
"_id" : ObjectId("63e1ee7a89252e00253e112a"),
"userId" : ObjectId("62ce989e896a890026078fac"),
"companyId" : ObjectId("5a8660c96f7d974a3edf4b8d"),
"orderId" : "O20010",
…

Gayathri Rajan
- 369
- 1
- 6
- 18
0
votes
0 answers
What's the correct way to proxy TestRestTemplate connections?
I waned to redirect TestRestTemplate trough proxy. The difficult part for me is that I cannot create new TestRestTemplate because I am using it inside Spring Boot test so I have to use @Autowired.
@SpringBootTest(webEnvironment =…

u4963840
- 81
- 1
- 8
0
votes
0 answers
Exception while trying to connect to mangodb -- org.mongodb.driver.cluster : Exception in monitor thread while connecting to server localhost:27017
i am trying for the firsttime, to connect to mongodb. and i get the exception and so connectiion is refused. I am using SprintBoot3.0 and below are the Maven Depedencies.
org.springframework.boot
…

Kalpana
- 1
0
votes
1 answer
How to enforce CORS with Spring Boot Data Rest?
I have created a Sing Data Repository and made it accessible through Spring Data REST (Spring Boot 2.7.2). I would expect it to reject any CORS, but it does not happen. I double-checked: I have neither calls to addCorsMappings, nor @CrossOrigin…

Franco G
- 375
- 3
- 12
0
votes
0 answers
Is there a way to create a link to a RepositoryRestController from a normal RestController?
I am trying to create a link to a RepositoryRestController from a normal RestController. The links being created by WebMvcLinkBuilder do not contain the expected spring.data.rest.basePath. RepositoryEntityLinks doesn't exactly work because I'm…

Chris Jurcina
- 1
- 1
0
votes
0 answers
Injection in custom Validator return null
I have already looked in stackoverflow and other websites but found nothing which worked for me.
(Spring boot 3)
Log : Resolved [jakarta.validation.ValidationException: HV000028: Unexpected exception during isValid call.]
-> Certainly due to my…

R Am
- 11
- 1
- 2
0
votes
0 answers
Update field in @ManyToOne relationship using Spring Data JPA
I am trying to change the task status (there are 3 permanent tasks in the database: To do, In progress, Done).
I tried to use Spring Data JPA's built-in REST and the patch method but it doesn't work
The next step was to do the logic…

stealthoust
- 26
- 5
0
votes
1 answer
Get Logged-in User
Please bare with me as I am learning Spring Data REST as I go. Definitely feel free to suggest a safer approach if what I am proposing here is not the safest approach or even possible.
Problem
A user logs into my Spring Data REST API via Google…

fire_water
- 1,380
- 1
- 19
- 33
0
votes
0 answers
Post nested objects with Spring Data REST
I'm trying using Spring Data Rest in a Spring Boot backend.
I have an entity named Request with some fields and another entity named RequestData.
Now, RequestData's mapped table has the foreign key referencing request_id (and nullable=false)
Then, I…
0
votes
0 answers
What is the best backend-id-conversion for composite primary key
I'm trying to use BackendIdConverter for my entities and repositories.
For those entities with compound primary keys, I'm using JSON encoding/decoding.
The uri is ugly.
{
"_embedded": {
"...": [
{
"id": {
"x": 34,
…

Jin Kwon
- 20,295
- 14
- 115
- 184
0
votes
0 answers
Spring Pageable parses "Sort" wrongly?
Using MongoDb and @RepositoryRestController and Pageable from Spring.
Controller method(passing in -- ?page=0&size=20&sort=events.field1,asc):
..WithCreator(@RequestBody ..., @ParameterObject final Pageable page)
I'm having a hard time finding out…

Daniel Jeney
- 486
- 1
- 5
- 19