Skip to content

Instantly share code, notes, and snippets.

@hkakutalua
Created June 3, 2020 22:12
Show Gist options
  • Save hkakutalua/482ff215afa951fc69645686cf1783b1 to your computer and use it in GitHub Desktop.
Save hkakutalua/482ff215afa951fc69645686cf1783b1 to your computer and use it in GitHub Desktop.
package com.example.partialupdates.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.openapitools.jackson.nullable.JsonNullableModule;
import org.springframework.context.annotation.Configuration;
import javax.annotation.PostConstruct;
@Configuration
public class JacksonConfiguration {
private final ObjectMapper objectMapper;
public JacksonConfiguration(ObjectMapper objectMapper) {
this.objectMapper = objectMapper;
}
@PostConstruct
ObjectMapper jacksonObjectMapper() {
objectMapper.registerModule(new JsonNullableModule());
return objectMapper;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment