public ObjectMapper createObjectMapper ( ) { ObjectMapper mapper = new ObjectMapper ( ) ; mapper . setVisibility ( PropertyAccessor . FIELD , JsonAutoDetect . Visibility . ANY ) . setVisibility ( PropertyAccessor . CREATOR , JsonAutoDetect . Visibility . ANY ) . setVisibility ( PropertyAccessor . SETTER , JsonAutoDetect . Visibility . NONE ) . setVisibility ( PropertyAccessor . GETTER , JsonAutoDetect . Visibility . NONE ) . setVisibility ( PropertyAccessor . IS_GETTER , JsonAutoDetect . Visibility . NONE ) ; mapper . configure ( SerializationFeature . FAIL_ON_EMPTY_BEANS , false ) ; return mapper ; }
Not sure about this . If correct and only need one only create one instance