Error starting ApplicationContext. To display the conditions report re-run your application with 'de

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-07-25 16:58:54.568 ERROR 67232 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

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

Description:

Field restOperations in com.example.api.config.controller.ConfigControllerOne required a bean of type 'org.springframework.web.client.RestOperations' that could not be found.


Action:

Consider defining a bean of type 'org.springframework.web.client.RestOperations' in your configuration.


Process finished with exit code 1

项目启动突然报错,之前一直好好的,怎么会突然报错呢,这是最让人头大的问题,从网上搜了好多说是依赖包重复了删掉即可,但是仔细查看了pom文件也没发现什么异常的地方,首先要定位到是修改了哪个class文件后引起的报错,

如下图所示肉眼观察确实也没有问题,但是依旧报错,然后我删除部分代码重新启动,终于发现是因为

然后我逐步删除部分代码重新启动,终于发现是因为多了行以下接口

@Autowired
private RestOperations restOperations;
这是我第二次碰到的问题了,在此立个flag不能再犯这种错误了!希望大家不要因此疏忽大意,如果你也遇到同样的问题看看是否是这个问题,如果不是这个问题,希望你在解决问题之后在留言区留言分享一下你的问题,谢谢!

猜你喜欢

转载自blog.csdn.net/lihua5419/article/details/81206129
今日推荐