TODO: add the following section somewhere

GeoJSON Jackson Modules

By using the [core.web], Spring Data registers additional Jackson Moduless to the ObjectMapper for de-/serializing common Spring Data domain types. Please refer to the [core.web.basic.jackson-mappers] section to learn more about the infrastructure setup of this feature.

The MongoDB module additionally registers JsonDeserializers for the following GeoJSON types via its GeoJsonConfiguration exposing the GeoJsonModule.

org.springframework.data.mongodb.core.geo.GeoJsonPoint
org.springframework.data.mongodb.core.geo.GeoJsonMultiPoint
org.springframework.data.mongodb.core.geo.GeoJsonLineString
org.springframework.data.mongodb.core.geo.GeoJsonMultiLineString
org.springframework.data.mongodb.core.geo.GeoJsonPolygon
org.springframework.data.mongodb.core.geo.GeoJsonMultiPolygon

The GeoJsonModule only registers JsonDeserializers!
To equip the ObjectMapper with a symmetric set of JsonSerializers you need to either manually configure those for the ObjectMapper or provide a custom SpringDataJacksonModules configuration exposing GeoJsonModule.serializers() as a Spring Bean.

class GeoJsonConfiguration implements SpringDataJacksonModules {

	@Bean
	public Module geoJsonSerializers() {
		return GeoJsonModule.serializers();
	}
}

The next major version (4.0) will register both, JsonDeserializers and JsonSerializers for GeoJSON types by default.