Questions tagged [spring-hateoas]

Spring HATEOAS provides some APIs to ease creating REST representations that follow the HATEOAS principle when working with Spring and especially Spring MVC. The core problem it tries to address is link creation and representation assembly.

Filter by
Sorted by
Tagged with
0 votes
0 answers
33 views

Model name mapping with Open API Code generator

I am using Open API Code generator to generate SDK for my APIs. https://openapi-generator.tech/docs/generators/spring/ My response POJO was as follows. class User { String name; String id; ...
krisnik's user avatar
  • 1,426
0 votes
0 answers
39 views

Target url placeholders missing after upgrading from spring-hateoas 1.3.5 to 2.1.2

Background We are currently upgrading our spring boot application from spring boot 2.7.10 -> 3.1.5. This pulls in a newer version of spring-hateoas which we'd like to move too as well (1.3.5 -> ...
Oliver Henlich's user avatar
0 votes
0 answers
40 views

hateoas links are not properly creating after spring boot 3 upgrade

After upgrading to springboot 3 and java 17 from 1.8 I am facing an issue with spring hateoas link been created by the WebMvcLinkBuilder.linkTo The expected link was https://test.com/dutyofcare/v1/...
harun prasu's user avatar
0 votes
0 answers
16 views

How can I populate links to paged entities in Spring Boot?

I have a functioning @RestController backed by a JpaRepository with a JpaSpecificationExecutor. My specification search is all working, and returns a Page<MyEntity>. Unfortunately, the paged ...
Foeclan's user avatar
  • 11
0 votes
1 answer
31 views

Rename "_embedded" to "data" or anything else in spring-hateoas

I am building REST API with Spring HATEOAS. After some tries, I got it upto this point. { "_embedded": { "organizations": [ { "id":...
Pradeep Agrawal's user avatar
0 votes
1 answer
54 views

Use case of HATEOAS between Angular frontend and Spring Boot

Will it be a good approach if I use HATEOAS and use API response with proper links to build a dynamic loosely coupled application, where It will not be hard coded URIs in frontend(Angular)(Most of the ...
Nafiz Ur Rahman's user avatar
1 vote
1 answer
133 views

How do I configure Spring Data REST to return links with templated ID such as users/{id}

Suppose I have Spring Data repository for a User entity. Then, Spring Data REST produces the following HAL JSON at its base path: { "_links": { "users": { "href&...
James's user avatar
  • 2,984
0 votes
0 answers
46 views

Spring hateoas could not resolve entity from URI when requestbody is List<EntityModel<Data1>> - Bulk Add

i have written a REST Api endpoint for Bulk-Add of an entity. Requestbody is List<EntityModel> and i get the below exception, m.m.a.ExceptionHandlerExceptionResolver : Resolved [org....
user22113043's user avatar
1 vote
0 answers
59 views

linkTo(): Not enough variable values to expand when @RequestMapping("${app-controller.path}") comes from properties

we have a working asynchronous REST API with Spring Boot and Hateoas: @RestController @EnableAutoConfiguration @RequestMapping("/metfrag/api/v1") /** @RequestMapping("${metfragrest-...
sneumann's user avatar
1 vote
1 answer
475 views

How to implement hateoas in Quarkus

I need to migrate our spring boot application to Quarkus. Facing the issue of how to implement the hateoas in Quarkus. Any suggestions are welcome. Spring boot code: import org.springframework.hateoas....
user1601373's user avatar
0 votes
0 answers
15 views

How to HATEOAS when API returns Long?

I would like to use HATEOAS in a Spring-boot @RestController; the method looks like @GetMapping("/{transactionId}") public UUID search(@PathVariable String transactionId){ ... return ...
lrkwz's user avatar
  • 6,175
0 votes
0 answers
32 views

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 ...
sonicrocketman's user avatar
0 votes
0 answers
22 views

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 ...
erotsppa's user avatar
  • 14.5k
0 votes
0 answers
106 views

Cannot deserialize enum after converting from HTTP to HTTPS in tests, 403 index outside legal range [0..2]

I'm working on a Kotlin spring boot project. It is an API for handling products and orders. I have been following this guide closely. Everything has been great until I wanted to add HTTPS instead of ...
shlfdn's user avatar
  • 1
0 votes
1 answer
40 views

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....
offenbach's user avatar
0 votes
0 answers
89 views

MappingJackson2HttpMessageConverter and _halObjectMapper not working with spring-hateos 2.0.1 and spring boot 3

We have a legacy app which we are updating to spring boot 3. We used to use spring-hateos 0.24 RELEASE and below code to register MappingJackson2HttpMessageConverter. public static class ...
Anish Sharma's user avatar
1 vote
0 answers
190 views

spring hateoas hal-forms affordance support not working after upgrade to spring boot 3 due to jakarta.validation and hibernate version conflict

Spring Hateoas doesn't seem to be offering support for template affordance property validation in HAL-FORMS if you upgrade to Spring Boot 3. It seems to be Spring Boot moving to newer versions of ...
g10n's user avatar
  • 11
0 votes
1 answer
46 views

Unable to store and retrieve Spring HATEOAS EntityModel in Redis

I have a use case where we are trying to store and retrieve content from Redis cache. We are using spring-starter-cache for making use of the underlying redis cache storage. @Bean public ...
Abhilash's user avatar
  • 823
0 votes
1 answer
24 views

Spring HATEOS paging response object is showing incorrect last link

I am trying to build custom response object, but in the final response i am getting incorrect link for last element. Any thought ? Request :/searchx?page=2&size=5&total_required=true Response :...
ERK's user avatar
  • 354
1 vote
0 answers
72 views

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. ...
Chris Jurcina's user avatar
0 votes
1 answer
79 views

Spring-boot Api endpoint for uploading file not working after adding 'spring-boot-starter-hateoas' dependency

I have a simple API function to upload a file similar to: @PostMapping(value = "/documents", consumes = {MediaType.MULTIPART_FORM_DATA_VALUE}) public Mono<ResponseEntity<...
user1796624's user avatar
  • 3,735
0 votes
1 answer
12 views

Spring Hateos 2 does not make injection when creating lintTo

I try to create a simple controller with spring hateoas. The controller is the following : @RestController public class SearchController { private final List<Plugin> plugins; @...
Scandinave's user avatar
  • 1,388
0 votes
0 answers
19 views

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": { ...
Jin Kwon's user avatar
  • 20.7k
0 votes
0 answers
37 views

Hateoas links are generated without queryString

For ex: If my request url is : baseurl/books?name=xyz&page=0&size=20 Hateoas link looks like below: "self": {href: "baseurl/books?page=0&size=20"} Why doesn't name=xyz ...
Varad raikar's user avatar
3 votes
1 answer
6k views

Receiver class ch.qos.logback.classic.util.DefaultJoranConfigurator does not define or inherit an implementation of the resolved method

I added spring hateoas into a project and it is impossible to start de project. I added those libs: implementation 'com.toedter:spring-hateoas-jsonapi:2.0.1' implementation 'org....
emoleumassi's user avatar
  • 4,955
0 votes
1 answer
170 views

Consuming and parsing Spring Boot HATEOAS API's nested response in Angular

I have the following response JSON that I'm receiving from my back-end API: { "_embedded": { "vehicleListingList": [ { "id": 1, ...
user14728486's user avatar
0 votes
0 answers
71 views

Including tenant id in url using spring-boot and HATEOAS

I'm currently migrating a legacy multi tenant REST backend to spring-boot. All the environment is set to include the tenant ID in URL. I've managed to do this implementing my own Rest Controller ...
Pablo Perich's user avatar
3 votes
0 answers
46 views

Hibernate Enverse in Java is using Proxies instead of Bags

Currently i'm worrking on a Java project which uses JPA and under the hood Hibernate as its ORM. Furthermore we're using Enverse as our auditing Library. Now, when i query an entity which contains a @...
Dignity's user avatar
  • 51
0 votes
2 answers
1k views

Upgrading to Springboot 3: 'org.springframework.hateoas.server.LinkRelationProvider' that could not be found

I am upgrading my springboot app from 2.7.x to 3.0.0, I have made required changes for jakartaEE. When starting my app I am getting the below error {"@timestamp":"2023-01-03T15:28:01....
Bruce_Wayne's user avatar
  • 1,554
0 votes
1 answer
575 views

Is it possible to generate Spring hateoas entities with openapi

I'm trying to use openapi to generate an enitity that uses the spring-hateoas RepresentationModel class. Example: import com.fasterxml.jackson.annotation.JsonIgnore; import jakarta.persistence.*; ...
MSmith's user avatar
  • 59
0 votes
1 answer
172 views

Spring Data: Page information missing fron response on using CollectionModel with RepositoryRestController

My repository method is: public Page<Order> findByStatusIn(List<OrderStatus> orderStatuses, Pageable pageable); Which is called from Controller (@RepositoryRestController) as : Pageable ...
Shoreki's user avatar
  • 1,057
0 votes
0 answers
34 views

Caching GET method of @RepositoryRestResource

I have a @RespositoryRestResource class. Only the GET operation is being used which returns all the data. This is taking some time. So I want to cache this call. However I'm not sure how to achieve ...
Hari Narayanan's user avatar
0 votes
1 answer
44 views

call a controller method without passing requestparams to it

I have an GET method to get all paginated songs from repository. I try to use HATEOAS and I'm trying to create a link to all songs, but when I need to call the controller method to get all songs, I ...
varo111's user avatar
  • 327
0 votes
1 answer
257 views

Can't retrieve JPA data from Postgres Database

I have two models related by a OneToMany Relationship. @Entity @Getter @Setter @NoArgsConstructor @Table(name = "GroupChat") public class GroupChat extends RepresentationModel<GroupChat&...
MSmith's user avatar
  • 59
0 votes
1 answer
582 views

Render HAL formatted links in openapi3 json with SpringDoc

I'm running a Spring Boot REST application with Spring HATEOAS support and generating OpenAPIv3 docs with the Springdoc Maven plugin. However when I call my REST endpoints I get links the in HAL ...
binarylegit's user avatar
0 votes
1 answer
187 views

Test Rest Template HATEOAS API return empty body but curl get the content

I make an API with Springboot <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-rest</artifactId> <version>2.7.5&...
Dandy's user avatar
  • 23
0 votes
0 answers
269 views

How to deserialize json object referring related data using hal links with Jackson and GraalVm?

I'm currently struggling to implement a restfull api using -> Spring Boot 3.0.0, using spring data rest and spring hateoas -> Spring native support Basically, I would like to patch an entity, ...
Mathieu Pedrero's user avatar
0 votes
0 answers
226 views

Spring Boot 2.7.5 with Spring Hateoas 1.x version is generating issues with Gson

I'm working in a migration from spring boot 2.1 to spring boot 2.7.5, so far so good until I face a situation with spring hateoas (1.x) and Gson. The main situation is I cannot serialize properly an ...
Romi's user avatar
  • 1
0 votes
2 answers
121 views

Generate Link To Spring Data Rest Controller

I created a REST API with Spring Data Rest that forks fine. It must be possible to clone Projects via the API, so I added a custom @RestController to implement that via POST /projects/{id}/clone. @...
user3235738's user avatar
0 votes
1 answer
56 views

Spring Data REST inconsistent custom Controller enpoints

I've got a Spring Data Rest application with a sent of entities exposed as REST endpoints. My main entity is a Listing, which includes a list of Items: @Entity @Data @AllArgsConstructor @...
chrx's user avatar
  • 2,189
1 vote
0 answers
225 views

HATEOAS - links are added on every single request

I have a rest API for class Tag, and want to add a link for each object. but the duplicate link is added on every request(which calls the findAll() method). see the pictures below tag after first ...
nikoloz adeishvili's user avatar
0 votes
1 answer
88 views

RESTful Web Service - nested resources require many requests

I have a small question regarding the REST API design for a small management software. The backend is implemented in Spring and the frontend in angular. Buildings, rooms and workplaces are managed ...
Helotrix's user avatar
  • 131
1 vote
1 answer
141 views

cannot infer type arguments for EntityModel<>

I am trying to upgrade spring boot from 2.1.6 to 2.6.6, The hateoas component has also been upgraded. I have renamed the class names as well using the migrate script. But in the code I am getting the ...
Ninjatech's user avatar
0 votes
1 answer
75 views

SpringBoot Hypermedia without HATEOAS

My client don’t want to use HATEOAS library for some reason. Or there any other maven dependency alternative to HATEOAS? I searched a lot but didn’t find any. Can someone help me with this please?
Vasu Youth's user avatar
1 vote
0 answers
206 views

Prevent Jackson from setting links field null when the client sends "_links" : null (links inherited from spring-hateoas RepresentationModel class)

I have Spring Boot API that uses spring-hateoas. I have a domain class that is used for request and response in my controller. The domain class inherits from spring-hateoas class RepresentationModel, ...
Horacio Conde's user avatar
1 vote
1 answer
204 views

Can Spring Data Rest use _links per HAL spec?

A POST request with media type, "application/hal+json", is issued to a Spring Data Rest endpoint, /api/groupMembers. It contains the following payload: { "id":null, "...
James's user avatar
  • 2,984
0 votes
1 answer
232 views

REST HAL Best Practice: Should I use links or nested JSON object when POSTing?

I would like to create a new Employee that reports to a Manager. An Employee cannot be POSTed without a Manager. Provided that I already have the Manager object and the URI for the Manager, is it a ...
James's user avatar
  • 2,984
1 vote
1 answer
191 views

How do I post nested entity to Spring Data Rest without setting @RestResource(exported = false)?

I've read this answer as a solution to POSTing an entity with nested entities. But I want to make a RESTful POST request. That is, I want nested entities to be represented with links. As an example, ...
James's user avatar
  • 2,984
0 votes
1 answer
27 views

How to de (serialize) _links so that value of "rel" value appear as element and _link as nested json

Spring hatios latest is keeping links as array rather than nested json and keeping relation name as "rel". We want "rel" value as child jsons root name. Please see the current and ...
Laxmikant's user avatar
  • 1,591
0 votes
1 answer
389 views

When extending the RepresentationModel<T> class of HATEOAS in the model using mongodb the application no longer works - spring boot

I'm studying spring building an API using spring-boot,mongodb,lombok, mongock... this project. When putting HATEOAS I had problems, I noticed that it was related the moment I inherit the ...
Eduardo Silva 218's user avatar

1
2 3 4 5
16