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
该问题比较蠢,记录下来避免再犯
更多推荐
学习记录报错Consider defining a bean of type ‘org.springframework.web.client.RestTempl
发布评论