Using postman raw testing spring-boot controller failed -
here controller:
here postman:
via form-data, can caseid
in controller.
but raw header, can't.
i don't know why... there wrong controller ?
please help, thanks.
edit 1:
yeah. add more
we know, springmvc bind data us, when use post request , put data in body via raw , content-type:application/json
, spring still bind data? request.getinputstream()
call once.
edit 2:
i found way raw.
get json string.
ps.
why post code image?
these codes simple , needn't run.
it's looks good.
here example of how retrieve data using postman
, bind springmvc
@requestmapping(value = "/user/", method = requestmethod.get) public responseentity<list<user>> listallusers() { list<user> users = userservice.findallusers(); if (users.isempty()) { return new responseentity(httpstatus.no_content); // many decide return httpstatus.not_found } return new responseentity<list<user>>(users, httpstatus.ok); }
you may refer article : spring boot rest api example
Comments
Post a Comment