required a bean of type 'org.springframework.web.client.RestTemplate' that could not be found.

发布时间 2023-04-04 15:03:03作者: companion

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-04-04 14:54:30.963 ERROR 49212 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :

***************************
APPLICATION FAILED TO START
***************************

Description:

Field restTemplate in com.example.consumer.controller.GoodsController 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.

2023-04-04 14:54:30.964 WARN 49212 --- [ Thread-3] c.a.n.common.http.HttpClientBeanHolder : [HttpClientBeanHolder] Start destroying common HttpClient
2023-04-04 14:54:30.964 WARN 49212 --- [ Thread-3] c.a.n.common.http.HttpClientBeanHolder : [HttpClientBeanHolder] Destruction of the end

 

解决方案参考文章:

https://blog.csdn.net/xch_yang/article/details/123356596