首页 > 编程语言 > 详细

spring mvc get请求也可以接受DTO对象

时间:2017-09-19 22:05:10      阅读:1432      评论:0      收藏:0      [点我收藏+]

spring mvc get请求也可以接受DTO对象,比如:url上面你还是将参数&符号连接起来,并自动封装进一个DTO对象里。

只有@RequestBody注解spring mvc才会从http body里去拿数据。

默认不填注解的参数都会从url上面去拿。

@ApiOperation(value = "查询卡券详情接口", consumes = "application/x-www-form-urlencoded")
@RequestMapping(value = "/detail", method = RequestMethod.GET)
public ProfitCouponDetailDTO queryDetail(@Valid CouponDetailQueryDTO queryDTO) {
logger.info("查询卡券详情入参:[{}]", queryDTO);
String offerType = queryDTO.getOfferType();
if (isNotCouponOrGP(offerType)) {
throw new ParammeterException("offer类型错误");
}

spring mvc get请求也可以接受DTO对象

原文:http://www.cnblogs.com/panxuejun/p/7554287.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!