Java之SpringCloud Eurka注册错误解决方案

网友投稿 208 2022-10-08


Java之SpringCloud Eurka注册错误解决方案

学习SpringCloud时,在Eurka中注册时出现的错误:

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

2019-10-04 11:15:19.703 ERROR 34860 --- [ main] o.s.b.d.Logginghttp://FailureAnalysisReporter :

***************************

APPLICATION FAILED TO START

***************************

Description:

Field discoveryClient in cn.itcast.consumer.web.ConsumerController required a bean of type 'com.netflix.discovery.DiscoveryClient' thttp://hat 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 'com.netflix.discovery.DiscoveryClient' in your configuration.

错误代码:

import com.netflix.discovery.DiscoveryClient;

@Autowired

private DiscoveryClient discoveryClient;

错误原因:导错了jar包

正确代码:

import org.springframework.cloud.client.discovery.DiscoveryClient;

@Autowired

private DiscoveryClient discoveryClient;


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:服务安全之: CAS服务的本地搭建方法(安全是服务之本)
下一篇:部署sqlilab(部署英文)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~