spring boot - Configuring Jackson to enable self-referencing objects using jackson-datatype-hibernate -


How do I configure Jackson ObjectMapper in Spring Data when using Spring Boot?

When I try to return a self referenced unit I'm getting a "com.fasterxml.jackson.databind.JsonMappingException: no serializer class org.hibernate.proxy.pojo.javassist.javassistLazyInitializer And to find a property BeanSerializer discovered (To avoid exceptions, when I try to retrieve the children of an object in a self-referenced table, disable the serialization function. FAIL_ON_EMPTY_BEANS " error.

I thought that The issue was a serialization problem that can be solved using the Jackson-Datatype-Hibernate package to help sort the self-referenced objects.

I have no definitive guidance till now I can see how to configure an existing ostapper instance that uses Spring Data Rest. / P>

I like the ObjectMaster sub-works according to the Geitheb page of the project C is required

  public class HibernateAwareObjectMapper extends ObjectMapper {public HibernateAwareObjectMapper () {registerModule (new Hibernate4Module ()); }}  

However, if I leave Object Mapper then will not I loose the default behavior of Jackson Object? I do not necessarily want to lose that behavior, just expand it. Besides, I comment on the class in order to pick up this @Component Spring Spring?

If you are using spring data rest, So I think you need spring boot 1.2 to get automatic updates for the object mapper (see for details). With the older versions you can inject your own I think (but if you need to configure all the features you need, then it is more than just a module).


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -