0

我有一个有方法的spring mvc控制器。此方法获取一些参数。我配置 swagger 并使用 swagger 测试请求。当我想尝试请求参数时,它不会发送。

@RequestMapping(value = "/listGrid", method = RequestMethod.GET)
public QueryResult<ActionViewModel> list(String searchFilter, String order,
                    int pageNumber, int pageSize) {
    return actionService.getAllGridList(new SearchOption(searchFilter, 
                order, pageNumber, pageSize));
} 

大摇大摆地为请求生成的卷曲是这个

 curl -X GET --header 'Content-Type: application/json' --header 'Accept: */*' --header 'Authorization: Bearer 792a553e-b371-48a9-b031-12b634de4ce6' **-d '1'** 'http://localhost:8086/api/security/action/listGrid'
4

1 回答 1

3

您是否尝试在每个参数中添加 requestParam 注释?

@RequestMapping(value = "/listGrid", method = RequestMethod.GET)
public QueryResult<ActionViewModel> list(
    @RequestParam String searchFilter,
    @RequestParam String order, 
    @RequestParam int pageNumber,
    @RequestParam int pageSize) {
    // body
}
于 2016-07-02T15:53:24.090 回答