I’m learning java and spring boot and I am trying to validate a controller parameter which was bound from json. I’ve got simple Entity: Which I want to persist through the following controller: My understanding is that the resource argument should be valid when entering the method. But posting an empty uri field does not trigger the validation of the
Tag: spring-rest
Multiple ‘as-value’ properties defined
I want to create a ENUM which holds different statuses for possible database values and use them also to generate possible drop down statuses in FE: Full code: https://github.com/rcbandit111/Search_specification_POC/blob/main/src/main/java/org/merchant/database/service/businesscustomers/BusinessCustomersStatus.java But when I make a POST request to add a new record I get this error: Note that I have changed TicketStatus with BusinessCustomersStatus into the error stack. When I make
How do you replace sub entities with HATEOAS links?
I am trying to figure out how to process a series of results in my controller, yet still return links for inline sub resources. when I hit the exposed repository endpoint, I get responses that look like the following: however when I hit my cached version of the entity, I get the following any idea how I can return something
Rest API ResponseEntity add extra attribute to response
I’m trying to figure out response of a GET method API, it is returning extra attribute with name “attributesMap” Reponse entity return code is return ResponseEntity.ok(document); document model class but the API reponse JSON as an extra attribute “attributesMap”. Sample JSON as below: { “id”: “xxx”, “format”: “xx”, “attributes”: [ { “name”: “attr1”, “values”: [ “val1” ] } ], “type”:
How to pass JSON Object and return Object from Spring rest controller
I have an entity class like below: Here is my rest controller: I have two questions: How can I send the report as well as Http Status back as a response? How to send the data to controller? I have created the following test case: When I run this the test case failed and I was able to pin point
Spring Boot REST API using LDAP authentication
So I’m trying to build a REST API that will use LDAP authentication. Basically, when my login endpoint is consumed, I want it to detect credentials using httpBasic authentication and then use those credentials against my LDAP server. I also want to take into account user roles, protecting endpoints so that only certain users with the proper roles can access
Spring generate progressive unique int for entity
I am working on a REST api in Spring, and I’m required to save an entity Document with a protocol number which consists in: Here is the model: I have come up with this solution: In other words I’m saving the object and updating it using the id the DB created, but I wonder if there is a better way
Is it possible to split request params in Spring controllers?
I have a request like: I would like to split those params to bind a List<String> sort in my controller or List<SortParam> where SortParam is the class with fields like: name (String) and ask (boolean). So the final controller would look like this: or Is there a way to make it? UPDATE: The standard way of passing parameters does not
Spring Pageable does not translate @Column name
I have Entity object : And I have database view defined like this: And I have repository with custom query: Everything works fine when I request standard data with url: http://localhost:8080/someEntity/search/findBySomeParameter?parameter=25&page=0&size=20 But when I add sorting information it doesn’t work: http://localhost:8080/someEntity/search/findBySomeParameter?parameter=25&page=0&size=20&sort=entityFieldName,asc will throw following exception (I’m using Oracle database): It seems like sorting field are not translated with @Column(name), but