Created
September 30, 2019 15:39
-
-
Save jometho/03764b994467b664a037eddb12eec0ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
- 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