Skip to content

Having @JsonDeserialize is causing mismatchinputexception after spring boot 3.4 and spring cloud 2024.0.0 upgrade #1239

Closed
@haajira

Description

@haajira

Immediately after upgrade we started facing this issue. we use spring cloud function to read message from queue and spring cloud function takes care of creating pojo. in that pojo we have one customdeserlizer for a field which is causing exception if the input is missing incoming msg. if we remove jsondeserializer annotation it works fine.

If I remove JsonDeserlize annotation then it works fine.


@DaTa
@builder
public class TestClass implements Serializable{

**@JsonDeserialize(using = Deseril.class)**
public Integer number;

private Integer number2;

}

@Bean
public Consumer<Message<TestClass>> process() {
    return event->{
        try {
            TestClass data = event.getPayload();
        }catch(Exception e) {
            log.error(" exception ", e);
        }
    };
}

com.fasterxml.jackson.databind.exc.MismatchedInputException: Trailing token (of type FIELD_NAME) found after value (bound as com.fasterxml.jackson.databind.JsonNode): not allowed as per DeserializationFeature.FAIL_ON_TRAILING_TOKENS
at [Source: REDACTED (StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION disabled); line: 2, column: 1]
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:63)
at com.fasterxml.jackson.databind.DeserializationContext.reportTrailingTokens(DeserializationContext.java:1840)
at com.fasterxml.jackson.databind.ObjectMapper._verifyNoTrailingTokens(ObjectMapper.java:5025)
<============-> 94% EXECUTING [6m 41s]ind.ObjectMapper._readValue(ObjectMapper.java:4898)
at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:3146)
at com.xxx.events.stream.listener.Deseril.deserialize(Deseril.java:25)
at com.xxx.events.stream.listener.Deseril.deserialize(Deseril.java:16)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions