“RestTemplate get 方式,getForObject 请求时带有参数的6种情况”的版本间的差异
跳到导航
跳到搜索
Jihongchang(讨论 | 贡献) (建立内容为“https://www.bilibili.com/video/BV1AN411Z7mx?p=9”的新页面) |
Jihongchang(讨论 | 贡献) |
||
第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;
}
}