使用@ResponseBody未将Pojo转换为Json的列表

时间:2015-05-21 11:10:27

标签: java json spring

我有如下控制器类:

//consider context as being the Context of your current app
PackageManager packageManager = context.getPackageManager();
Intent intent = packageManager.getLaunchIntentForPackage(PACKAGE_NAME);
context.startActivity(intent);
device.wait(Until.hasObject(By.pkg(PACKAGE_NAME)), 10000);  //this is a UiAutomator method to wait for the application to be started (or 10 seconds).

POJO类GetEntitlementOverviewReportResult是:

  @RequestMapping(value = "/Reporting/FilterAsJson", method =    RequestMethod.POST)
     public @ResponseBody  PagedQueryResult<GetEntitlementOverviewReportResult>    filterAsJson(@ModelAttribute GetEntitleReportQuery query, HttpSession  session)

       {
        getEntitlementOverviewFromSession(session).updateFromQuery(query,   session);
            return  queryDispatcher.dispatch(query);}

问题是当设置bean类中的所有字段时,正确的Json将作为响应返回。但是当只有前6个字段被设置时,响应在调试器工具中失败并出现500错误,并且不会返回到调用ajax方法。我在浏览器中弹出“内部错误”。我在这里失踪了什么?是不是可以忽略其值未被提取的其他字段?我也尝试过使用@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL),但它没有任何区别。

0 个答案:

没有答案