@RestController使用 接收jso参数 将参数转换为对象

package com.monitor.controller;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.monitor.param.VersionParam;

import esign.utils.bean.Result;

/***
 * 类名:VersionController.java <br/>
 * 功能说明:后台接口配置版本 <br/>
 * 修改历史: <br/>
 * 1.[2016年8月1日上午10:08:13]创建类 by pxh
 */

@RestController
@RequestMapping(path = "/ version")
public class VersionController {

    @RequestMapping(path = "/getInterfaceVersion")
    // 使用@RequestBody注解将json参数转换为对象
    public ResponseEntity<Result> getInterfaceVersion(
            @RequestBody VersionParam param) {
        Result result = new Result();

        return ResponseEntity.ok().body(result);
    }

}

postMa测试

原文地址:https://www.cnblogs.com/ph123/p/5725244.html