
学习记录报错Consider defining a bean of type ‘org.springframework.web.client.RestTemplate‘ in your configu
springboot启动就报错
信如下
Field restTemplate in com.atguigu.springcloud.controller.OrderController required a bean of type 'org.springframework.web.client.RestTemplate' that could not be found.
The injection point has the following annotations: - @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'org.springframework.web.client.RestTemplate' in your configuration.
我的代码
@Configurable public class ApplicationContextConfig{ @Bean public RestTemplate restTemplate() { return new RestTemplate(); } }注解错误导致
@Configurable
换成
@Configuration
再次启动ok
该问题比较蠢,记录下来避免再犯
👁️ 阅读量:0
© 版权声明:本文《学习记录报错Consider defining a bean of type ‘org.springframework.web.client.RestTemplate‘ in your configu》内容均为本站精心整理或网友自愿分享,如需转载请注明原文出处:https://www.zastudy.cn/wen/1686552784a290032.html。