Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jometho/03764b994467b664a037eddb12eec0ce to your computer and use it in GitHub Desktop.
Save jometho/03764b994467b664a037eddb12eec0ce to your computer and use it in GitHub Desktop.
/**
- Spring Boot uses Jackson by default for serializing and deserializing request and response objects in your REST APIs.
- Jackson cannot deserialize GeoJson by default.
- So we need this library solve the issue: https://github.com/bedatadriven/jackson-datatype-jts.
Withut it Jackson will fail to desirialize due to recursive calls in the Feature and FeatureCollection properties
- To register JtsModule , you can either do a configuration class and annotate it with @Configuration then
add the JtsModule @Bean inside together with the registration in the ObjctMapper
or do this in your Main class.
**/
@Bean
public JtsModule jtsModule(){
System.out.println(">>>>>>>>>>>>>>>>>>>>>>JST MoDULE LOADED>>>>>>>>>>>>>>>>> ");
return new JtsModule();
}
@Bean
public ObjectMapper objectMapper() {
ObjectMapper mapper = new ObjectMapper();
//mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
//mapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, true);
mapper.registerModule(new JtsModule());
System.out.println(">>>>>>>>>>>>>>>>>>>>>>JST MoDULE CONFIGURED>>>>>>>>>>>>>>>>> ");
return mapper;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment