Skip to content
Advertisement

Tag: spring-rest

spring rest @RequestBody does not validate with @Valid

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

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

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”:

Advertisement