“RestTemplate 总体介绍”的版本间的差异
跳到导航
跳到搜索
Jihongchang(讨论 | 贡献) (建立内容为“https://www.bilibili.com/video/BV1AN411Z7mx?p=7”的新页面) |
Jihongchang(讨论 | 贡献) |
||
第1行: | 第1行: | ||
https://www.bilibili.com/video/BV1AN411Z7mx?p=7 | https://www.bilibili.com/video/BV1AN411Z7mx?p=7 | ||
+ | |||
+ | RestTemplate 是 spring-web-xxx.jar 包中提供的 HTTP 协议实现类,与 HttpClient 功能类似。 | ||
+ | |||
+ | 也就是说导入 spring-boot-starter-web 的项目可以直接使用 RestTemplate。 | ||
+ | |||
+ | 在该类中主要针对6类请求方式封装了方法: | ||
+ | {| class="wikitable" | ||
+ | !HTTP method | ||
+ | !RestTemplate methods | ||
+ | |- | ||
+ | |DELETE | ||
+ | |delete | ||
+ | |- | ||
+ | |GET | ||
+ | |getForObject | ||
+ | getForEntity | ||
+ | |- | ||
+ | |HEAD | ||
+ | |headForHeaders | ||
+ | |- | ||
+ | |OPTIONS | ||
+ | |optionsForAllow | ||
+ | |} |
2023年3月26日 (日) 04:59的版本
https://www.bilibili.com/video/BV1AN411Z7mx?p=7
RestTemplate 是 spring-web-xxx.jar 包中提供的 HTTP 协议实现类,与 HttpClient 功能类似。
也就是说导入 spring-boot-starter-web 的项目可以直接使用 RestTemplate。
在该类中主要针对6类请求方式封装了方法:
HTTP method | RestTemplate methods |
---|---|
DELETE | delete |
GET | getForObject
getForEntity |
HEAD | headForHeaders |
OPTIONS | optionsForAllow |