原创博文,欢迎转载,转载时请务必附上博文链接,感谢您的尊重。
问题描述:
初学 SpringCloud 架构,配置ribbon消费者服务,启动该服务时候报出标题中的错误,导致程序启动失败。
完整的错误信息如下:
Field restTemplate in com.cloud.ribbon_consumer.project.service.HelloService required a bean of type 'org.springframework.web.client.RestTemplate' that could not be found.
其中,“com.cloud.ribbon_consumer.project.service.HelloService”是我的示例中使用RestTemplate实例的路径。
具体问题见下图:
我的代码示例: