Required request body content is missing: org.springframework.web.method.HandlerMethod$HandlerMethodParameter Required request body content is missing: org.springframework.web.method.HandlerMethod$HandlerMethodParameter ajax ajax

Required request body content is missing: org.springframework.web.method.HandlerMethod$HandlerMethodParameter


You shouldn't send a request body with an HTTP GET request. You should modify addDepartment() so that it only supports POST, and POST your JSON to that endpoint. If you want to GET information about a department, you should create a separate controller method that does that (and does not require a request body).

Also, double-check your endpoint definitions since you have misspelled "reimbursement" in the $.ajax call.


I also had the same problem. I use "Postman" for JSON request. The code itself is not wrong. I simply set the content type to JSON (application/json) and it worked, as you can see on the image below

My Code


Try this:

@RequestBody(required = false) String str