今天git拉取项目后,运行项目出现了报错信息
Field restTemplate in required a bean of type ‘org.springframework.web.client.RestTemplate’ that could not be found.
Consider defining a bean of type ‘org.springframeword.web.client.RestTemplate’ in your configuration
主要原因是因为 SpringBoot1.4 版本以后需要在启动器里自定义RestTemplate,即在启动器中加入如下代码即可
@Bean
public RestTemplate getRestTemplate(){
return new RestTemplate();
}