<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ``` // @RestController: 等同于 @Controller + @RequestBody 注解 @RestController public class HelloController { // GET /get?name=劍齒虎 @GetMapping("/get") public String get(@RequestParam(name = "name", defaultValue = "劍齒虎") String name, @RequestParam("age") Integer age) { // defaultValue 默認值 // @RequestParam() 還有一個 required(bool類型), 是否必填參數 return name + "--" + age; } // POST /json {"name":"余小波", "age":16} @PostMapping(value = "/json", produces = MediaType.APPLICATION_XML_VALUE) public Lrz woc(@RequestBody Lrz lrz) { // 響應XMl, JSON同理 不過可以忽略produces, 默認即json lrz.setName("天王蓋地虎"); return lrz; } // GET /formdata?name=余小波&age=14 @GetMapping("/formdata") public String formdata(Lrz lrz) { return lrz.toString(); } } ``` ### @RestController 資源控制器, 相當于`@Controller`+`@RequestBody` ``` @RestController public class HelloController { ... } ``` ### 請求類型 springboot是以注解來定義請求方法的, 定義請求方法的注解有以下幾個 - GetMapping - PostMapping - PutMapping - DeleteMapping ```java @GetMapping("/employees") List<Employee> all() { ... } @PostMapping("/employees") Employee newEmployee(@RequestBody Employee newEmployee) { ... } // Single item @GetMapping("/employees/{id}") Employee one(@PathVariable Long id) { ... } @PutMapping("/employees/{id}") Employee replaceEmployee(@RequestBody Employee newEmployee, @PathVariable Long id) { ... } @DeleteMapping("/employees/{id}") void deleteEmployee(@PathVariable Long id) { ... } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看