8
我想从用户的特定请求的后端调用另一个web-api。 举例我想打电话给google FCM发送消息api发送消息给特定用户的一个事件。在Spring-Boot中从我的服务器调用另一个休息api
是改装有什么办法可以达到这个目的吗?或者如果不是我能做到的话?
我想从用户的特定请求的后端调用另一个web-api。 举例我想打电话给google FCM发送消息api发送消息给特定用户的一个事件。在Spring-Boot中从我的服务器调用另一个休息api
是改装有什么办法可以达到这个目的吗?或者如果不是我能做到的话?
This website has some nice examples for using spring's RestTemplate. 这里是它如何工作,得到一个简单的对象的代码示例:
private static void getEmployees()
{
final String uri = "http://localhost:8080/springrestexample/employees.xml";
RestTemplate restTemplate = new RestTemplate();
String result = restTemplate.getForObject(uri, String.class);
System.out.println(result);
}
你并不需要一个第三方库。春天已经有['RestTemplate'](http://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/client/RestTemplate.html) –
好吧,让我知道我如何使用休息模板? – Kenji
做一些研究。这非常简单。 –