当GET请求时,Spring不以毫秒为单位将日期映射到POJO

时间:2015-09-23 09:34:49

标签: java spring rest get

我有请求以毫秒为单位发送日期参数:

http://localhost:8090/advanced-search-for-publications?fromPublicationDate=11111111

和bean这样:

public class AdvancedSearchForPublicationsRequest {

    private Date fromPublicationDate;

    public Date getFromPublicationDate() {
        return fromPublicationDate;
    }

    public void setFromPublicationDate(Date fromPublicationDate) {
        this.fromPublicationDate = fromPublicationDate;
    }
}

和Controller这样:

@RequestMapping(value = "advanced-search-for-publications", method = RequestMethod.GET)
@ResponseBody
public Response<PublicationsSearchResult> advancedSearchForPublications(AdvancedSearchForPublicationsRequest request) {
    System.out.println(request.getFromPublicationDate());

    //TODO change it
    return null;
}

但程序打印为空。我可以做些什么来使这个映射有效?

0 个答案:

没有答案