Library not getting initialized?
Closed this issue · 1 comments
tom-mayer commented
Hi,
when trying to deserialize a Point in my Restcontroller from an Entity I get the follwing error:
(StackOverflowError); nested exception is
com.fasterxml.jackson.databind.JsonMappingException: Infinite
recursion (StackOverflowError) (through reference chain:
com.vividsolutions.jts.geom.Point[\"envelope\"]-
>com.vividsolutions.jts.geom.Point[\"envelope\"]....
The entity looks like this (shortened for brevity):
@Entity
@Data
public class MyEntity{
// ...
@Column(columnDefinition = "geometry")
private Point location;
// ...
}
As per documentation in boot, I tried adding your library to the @Configuration
in the following two ways:
@Bean
public Jackson2ObjectMapperBuilder jacksonBuilder() {
Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder();
builder.modulesToInstall(new JtsModule());
return builder;
}
and
@Bean
public JtsModule jtsModule(){
return new JtsModule();
}
Both didn't remove the exception. Should this work?
Cheers
tom-mayer commented
Hey, sry I'll close this. It's a Jackson issue. The ObjectMapper is configured correctly and if I autowire it and use it maually, everything works as expected. Just Jackson does not pick up my configired mapper.