最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

SpringBoot @RequestParam、@PathVaribale、@RequestBody實(shí)戰(zhàn)案例

 更新時(shí)間:2020年11月13日 09:31:25   作者:瑞 新  
這篇文章主要介紹了SpringBoot @RequestParam、@PathVaribale、@RequestBody實(shí)戰(zhàn)案例,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

實(shí)例User

package com.iflytek.odeon.shipper.model.rx;

import io.swagger.annotations.ApiModelProperty;

public class Student {
  @ApiModelProperty(value = "名稱", example = "zhangsan", required = true)
  private String name;
  private Integer call;

  public Student() {
  }

  public Student(String name, Integer call) {
    this.name = name;
    this.call = call;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public Integer getCall() {
    return call;
  }

  public void setCall(Integer call) {
    this.call = call;
  }

  @Override
  public String toString() {
    return "Student{" +
        "name='" + name + '\'' +
        ", call=" + call +
        '}';
  }
}

實(shí)例Controller

package com.iflytek.odeon.shipper.controller;

import com.iflytek.odeon.shipper.model.rx.Student;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * 測(cè)試注解及調(diào)試功能API
 */
@RestController
@RequestMapping("/v1")
public class SampleController {

  @PostMapping("/hi")
  public Student hi(@RequestBody() Student student) {
    return new Student(student.getName(), student.getCall());
  }


  @PostMapping("/hello")
  public Student hello(@RequestParam(value = "name") String name, @RequestParam(value = "call") Integer call) {
    Student stuResponse = new Student();
    stuResponse.setName(name + "call");
    stuResponse.setCall(call);
    return stuResponse;
  }

  @GetMapping("/hello/{id}")
  public Integer getUrl(@PathVariable(value = "id") Integer id) {
    return id;
  }
}

效果

body

在這里插入圖片描述

parme key value

在這里插入圖片描述

pathvar
/{id}

在這里插入圖片描述

到此這篇關(guān)于SpringBoot @RequestParam、@PathVaribale、@RequestBody實(shí)戰(zhàn)案例的文章就介紹到這了,更多相關(guān)SpringBoot @RequestParam、@PathVaribale、@RequestBody內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論

巴中市| 茂名市| 怀仁县| 梓潼县| 伊金霍洛旗| 晋宁县| 体育| 虹口区| 福鼎市| 塔城市| 林西县| 广宗县| 安达市| 吴桥县| 疏勒县| 年辖:市辖区| 深圳市| 界首市| 龙井市| 牡丹江市| 罗甸县| 晋州市| 松潘县| 新化县| 武清区| 铜鼓县| 神农架林区| 遂溪县| 贵南县| 慈利县| 若羌县| 巴中市| 句容市| 胶州市| 弥渡县| 商水县| 冕宁县| 错那县| 漯河市| 鹿邑县| 陆川县|