Java之SpringCloud Eurka注册错误解决方案
时间:2022-01-17 10:49:39|栏目:JAVA代码|点击: 次
学习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.LoggingFailureAnalysisReporter : *************************** APPLICATION FAILED TO START *************************** Description: Field discoveryClient in cn.itcast.consumer.web.ConsumerController required a bean of type 'com.netflix.discovery.DiscoveryClient' 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 '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;
上一篇:Java拦截器Interceptor和过滤器Filte的执行顺序和区别
栏 目:JAVA代码
下一篇:Java实现单向链表反转
本文标题:Java之SpringCloud Eurka注册错误解决方案
本文地址:http://www.codeinn.net/misctech/190502.html


阅读排行
- 1Java Swing组件BoxLayout布局用法示例
- 2java中-jar 与nohup的对比
- 3Java邮件发送程序(可以同时发给多个地址、可以带附件)
- 4Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.Type异常
- 5Java中自定义异常详解及实例代码
- 6深入理解Java中的克隆
- 7java读取excel文件的两种方法
- 8解析SpringSecurity+JWT认证流程实现
- 9spring boot里增加表单验证hibernate-validator并在freemarker模板里显示错误信息(推荐)
- 10深入解析java虚拟机




