HttpMediaTypeNotSupportedException: Content type ‘application/json;charset=UTF-8’ not supported
Error:
{
"timestamp": "2021-12-13T11:49:33.305+00:00",
"status": 415,
"error": "Unsupported Media Type",
"path": "/api/v1/product/add"
}
If you are sure that there is no problem with your parameters, it is likely that the problem lies in your @requestbody AAA a
the problem I encounter here is that protobuf is used, but no corresponding bean is injected, resulting in an error. Just add the following code to the application:
PS: protobufmodule is our own extended com fasterxml.jackson.databind.Module class, it’s inconvenient to put it out. You can consult the data by yourself
@Bean
ProtobufJsonFormatHttpMessageConverter protobufHttpMessageConverter() {
return new ProtobufJsonFormatHttpMessageConverter();
}
@Bean
public Jackson2ObjectMapperBuilderCustomizer jsonCustomizer() {
return builder -> builder.serializationInclusion(JsonInclude.Include.NON_NULL)
.modules(new ProtobufModule(), new JavaTimeModule());
}
Read More:
- [Solved] Error while extracting response for type [] and content type []…
- [Solved] Conversion not supported for type java.time.LocalDateTime
- maven Error: Element ‘dependency’ cannot have character [children], because the type’s content type is
- [Solved] MongoDB Error: TypeError: Object of type ObjectId is not JSON serializable
- [How to Solve] Content with element type ‘mapper’ must match
- How to Solve Error: Element ‘dependency’ cannot have character [children], because the type’s content type is element-
- JSON parse error: raw timestamp (1595952000000) not allowed for
- Springboot running shows application run failed [How to Solve]
- Json: struct field readyReplicas has json tag but is not exported [How to Solve]
- [Solved] Springboot Startup Error: Consider defining a bean of type ‘XXX’ in your configuration.
- AAR Call Error: only jar-type local dependencies are supported
- JSON parse error: Can not deserialize instance of java.lang.String out of START_OBJECT token
- [Solved] Error getting bean using springboot: no qualifying bean of type ‘xxx’ available
- [Solved] Springboot project Create to start Error: APPLICATION FAILED TO START
- [Solved] Bat starts springboot project error: ERROR org.springframework.boot.SpringApplication -Application run failed
- [Solved] SpringBoot Error: This application has no explicit mapping for /error, so you are seeing this
- [Solved] SyntaxError:JSON.parse:unexpected character at line 1 column 1 of the JSON data
- SpringBoot IntegratenRedis Annotations and access error: EL1008E: Property or field ‘getListMember‘ cannot be found on object of type
- SpringBoot Error running ‘Application’: Command line is too long.Shorten command line for
- How to Solve Springboot Error: Failed to convert value of type