resttemplate
然后使用
@RestController
public class HelloController {
@Autowired
private RestTemplate restTemplate;
@RequestMapping("/hello")
public String hello() {
return "Hello from Spring Boot!";
}
@RequestMapping("/chaining")
public String chaining() {
ResponseEntity<String> response = restTemplate.getForEntity("http://localhost:8080/hello", String.class);
return "Chaining + " + response.getBody();
}
}