“RestTemplate get 方式,getForObject 请求时带有参数的6种情况”的版本间的差异

来自姬鸿昌的知识库
跳到导航 跳到搜索
(建立内容为“https://www.bilibili.com/video/BV1AN411Z7mx?p=9”的新页面)
 
第1行: 第1行:
 
https://www.bilibili.com/video/BV1AN411Z7mx?p=9
 
https://www.bilibili.com/video/BV1AN411Z7mx?p=9
 +
 +
=== Application Service 中的 DemoController.java ===
 +
<syntaxhighlight lang="java">
 +
import org.springframework.web.bind.annotation.RequestMapping;
 +
import org.springframework.web.bind.annotation.RestController;
 +
 +
@RestController
 +
public class DemoController {
 +
 +
    @RequestMapping("/demo2")
 +
    public String demo2(String name, Integer age) {
 +
        return "name:" + name + ",age:" + age;
 +
    }
 +
 +
}
 +
</syntaxhighlight>

2023年3月26日 (日) 05:40的版本

https://www.bilibili.com/video/BV1AN411Z7mx?p=9

Application Service 中的 DemoController.java

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DemoController {

    @RequestMapping("/demo2")
    public String demo2(String name, Integer age) {
        return "name:" + name + ",age:" + age;
    }

}