Reputation: 13
@RequestMapping(value = "/NewCustomer", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
private void vNewCustomer(@RequestBody Customer xCustomer)
{
System.out.println("Post Request");
if(xCustomer != null
&& xCustomer.getCustomerName() != null
&& xCustomer.getCustomerMail() != null)
{
TableCustomerController.vGetInstance().vInsertCustomer(xCustomer);
}
}
It returns Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'text/plain;charset=UTF-8' not supported]
How should i solve it Thanks for your help..
Upvotes: 1
Views: 14438
Reputation: 1
You can check if is there any exception during mapping json request. I faced Failed to evaluate Jackson deserialization for type [...].Conflicting getter definitions for property[...]. Fix it exeption, the issue will be resolved.
Upvotes: 0
Reputation: 7792
In you method you specifically configured consumes = MediaType.APPLICATION_JSON_VALUE
. So you limited your method and specified that consumes this typed and then you complain that it doesn't take a different type. So either remove consumes
property or set it to MediaType.TEXT_PLAIN
or to just a String consumes = "text/plain;charset=UTF-8"
Upvotes: 1