[Solved] SpringBoot Error: HttpMediaTypeNotSupportedException: Content type ‘application/json‘ not supported

HttpMediaTypeNotSupportedException: Content type ‘application/json;charset=UTF-8’ not supported

    "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

    ProtobufJsonFormatHttpMessageConverter protobufHttpMessageConverter() {
        return new  ProtobufJsonFormatHttpMessageConverter();

    public Jackson2ObjectMapperBuilderCustomizer jsonCustomizer() {
        return builder -> builder.serializationInclusion(JsonInclude.Include.NON_NULL)
                .modules(new ProtobufModule(), new JavaTimeModule());

Read More: