how to include only certain class to apply jackson fail_on_unknown_properties with false

Viewed 43

how to include only certain class from the package to apply the ignore unknown properties value with false.

the below class are generated from swagger2.0, in the below i want to include only farm.java and gym.java

com.person.test.model 
          house.java
          farm.java
          gym.java
          school.java 

my package:
build
 -- generated
     src
       main 
        com.person.test
        api
          testapi.java
        model 
          house.java
          farm.java
          gym.java
          school.java

i want to know the right property to set up in application yml or through the way to handle in Objectmapper config class to include only certain class?

jackson:
    default-property-inclusion: non_null
    deserialization:
      fail_on_unknown_properties: false





 @Primary
      @Bean
      public Jackson2ObjectMapperBuilder globalObjectMapperBuilder(Module... modules) {
        return Jackson2ObjectMapperBuilder.json()
            .indentOutput(true)
            .featuresToDisable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
            .featuresToDisable(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES)
            .modulesToInstall(modules)
            .serializationInclusion(Include.NON_NULL);
      }
0 Answers
Related