很低级的错误,代码是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();
}
因篇幅问题不能全部显示,请点此查看更多更全内容