you are trying to inject the restTemplate but you need to create configuration class . then there you need to create bean that return you new RestTemplate see the below example.
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class YourConfigClass {
@Bean
public RestTemplate restTesmplate() {
return new RestTemplate();
}
}