步骤 1:注册RestTemplate
在order-service的OrderApplication中注册RestTemplate
@SpringBootApplication
public class SquareApplication {
public static void main(String[] args) {
SpringApplication.run(SquareApplication.class,args);
}
/**
* 创建RestTemplate 并注入Spring容器
* @return
*/
@Bean
public RestTemplate restTemplate(){
return new RestTemplate();
}
}