RestTemplate简介
文章目录
前言
RestTemplate 是 SpringResources 中一个访问第三方RESTFful API 的 接口网络请求框架。RestTemplate 的设计原则 和其他的Spring Template (例如 JdbcTemplate)类似,都是为了执行复杂任务提供了一个具有默认行为的简单方法。
RestTemplate 是用来消费REST 服务的,所以RestTemplate 主要方法都与REST的HTTP协议的一些方法紧密相连,例如HEAD、GET、PUT、POST、DELETE、OPTIONS等方法,这些方法在 RestTemplate 类对应的方法为 headForHeaders()、getForObject()、postForObject()、put()、delete()等