Robert Dennett wrote:I am developing a sample app and getting a 415 error stating that application/json is not supported.
Ron McLeod wrote:
Robert Dennett wrote:I am developing a sample app and getting a 415 error stating that application/json is not supported.
I'm not a Spring developer, but in other frameworks you typically need to specify the type of content that the handler consumes.
For example: @PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE)
Ron McLeod wrote:I assume that the object mapper requires that the class specified in the @RequestBody has a non-private no args constructor (either explicit or a default constructor)? Does your Customer class have one?
Ron McLeod wrote:For troubleshooting, try simplifying your Customer class to something bare bones like:
The post title wrote:Getting 415 errors in Spring Boot app
Ron McLeod wrote:Does the stack trace in the error message provide any clues? The original one you shared pointed back to the AbstractMessageConverterMethodArgumentResolver#readWithMessageConverters method. Is it still the same now?
Never use entity classes for data exchange on a rest service. Learn about 3 tier architecture –
Jens
Mar 15, 2019 at 20:57