@Bean public GeoModule jacksonGeoModule() { return new GeoModule(); } }
/** * Creates a new {@link GeoModule} registering mixins for common geo-spatial types. */ public GeoModule() { super("Spring Data Geo Mixins", new Version(1, 0, 0, null, "org.springframework.data", "spring-data-commons-geo")); setMixInAnnotation(Distance.class, DistanceMixin.class); setMixInAnnotation(Point.class, PointMixin.class); setMixInAnnotation(Box.class, BoxMixin.class); setMixInAnnotation(Circle.class, CircleMixin.class); setMixInAnnotation(Polygon.class, PolygonMixin.class); }
ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new GeoJsonModule()); mapper.registerModule(new GeoModule()); // Our custom module mapper.registerModule(new GeoModuleExt()); ClientConfig config = new DefaultClientConfig(); config.getSingletons().add(new JacksonJsonProvider(mapper)); Client client = Client.create(config);
ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new GeoJsonModule()); mapper.registerModule(new GeoModule());