***************************
APPLICATION FAILED TO START
***************************
Description:
Field restTemplate in lz.com.controller.SurpriseController required a bean of type 'org.springframework.web.client.RestTemplate' that could not be found.
Action:
Consider defining a bean of type 'org.springframework.web.client.RestTemplate' in your configuration.
解决办法:
在启动类添加RestTemplate
@EnableBatchProcessing
@EnableScheduling//定时器
@SpringBootApplication
@EnableDiscoveryClient
public class BatchApplication {
public static void main(String[] args) {
SpringApplication.run(BatchApplication.class,args);
}
//添加RestTemplate
@Bean
@LoadBalanced
public RestTemplate restTemplate(RestTemplateBuilder builder){
return builder.build();
}
}