DeferredResult返回空白页而不是json

时间:2017-06-10 17:04:56

标签: spring asynchronous spring-boot jackson

我在Spring引导中有休息控制器,当我返回空列表或者结果的完整结果时,响应是json并且它是正确的,但我想使用DeferredResult(因为非阻塞io)并且当我尝试返回deferredresult使用空列表然后控制器不返回任何内容......

出了什么问题?

@Async
@RequestMapping(path = "/test", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBodyDeferredResult<List<?>> test() throws ExecutionException, InterruptedException {

        final DeferredResult<List<?>> result = new DeferredResult<>();

        result.setResult(new ArrayList<>() );
        return result;

    }

1 个答案:

答案 0 :(得分:0)

如果您在Spring Boot中使用etags功能,请尝试将其添加到控制器方法中。

ShallowEtagHeaderFilter.disableContentCaching(request); 
相关问题