报错代码:
很低级的错误,代码是copy过来的,但是启动类是我自己手动创建的,导致没有观察到需要创建一个bean
Description:
Field restTemplate in com.changgou.oauth.service.impl.AuthServiceImpl 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.
报错位置:
解决方法:
只需要简单的简单地定义一个@Bean:
@Bean
@LoadBalanced
public RestTemplate restTemplate() {
return new RestTemplate();
}
更多推荐
Action:Consider defining a bean of type“org.springframework.web.client.RestTempl
发布评论