如何配置 AppEngine 使用的 ObjectMapper

问题描述

我有一个使用 Google Cloud EndPoints 提供服务的 AppEngine 项目。

某些请求和响应对象(我无法控制)没有属性

当这些端点被调用时,调用将失败:

com.google.api.server.spi.handlers.EndpointsMethodHandler$RestHandler handle: exception occurred while invoking backend method
com.fasterxml.jackson.databind.exc.InvalidDeFinitionException: No serializer found for class au.com.xandar.wylas.licence.endpoint.response.SendUserInviteResponse and no properties discovered to create BeanSerializer (to avoid exception,disable SerializationFeature.FAIL_ON_EMPTY_BEANS)

通常我只会在实例启动时获取 ObjectMapper 并调用

objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS,false);

但我正在努力弄清楚如何获取 AppEngine 正在使用的 ObjectMapper。

注意:

  • 我没有使用 Spring
  • 我没有使用 Guice

我不想将这两个框架中的任何一个引入混合。

如何检索 AppEngine 正在使用的 ObjectMapper 以便我可以修改它的配置?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)