Field discoveryClient in com.demo.eureka_client.controller.DcController required a bean of type 'com
原帖链接:http://www.spring4all.com/article/291点击打开链接问题描述: 按照原帖的教程,在编写eureka-client代码后,启动eureka-client发现启动失败并提示:Description:Field discoveryClient in com.demo.eureka_client.controller.DcCo
·
原帖链接:http://www.spring4all.com/article/291点击打开链接
问题描述:
按照原帖的教程,在编写eureka-client代码后,启动eureka-client发现启动失败
并提示:
Description:
Field discoveryClient in com.demo.eureka_client.controller.DcController required a bean of type
'com.netflix.discovery.DiscoveryClient' that could not be found.
Action:
Consider defining a bean of type
'com.netflix.discovery.DiscoveryClient' in your configuration.
仔细检查了代码,在启动类上加上了
@EnableDiscoveryClient仍然还有这个错误。
问题原因:DiscoveryClient导错了jar包。
我导入了
com.netflix.discovery.DiscoveryClient;正确的应该是 import
org.springframework.cloud.client.discovery.DiscoveryClient;
解决方案:
导入正确的jar包即可
import
org.springframework.cloud.client.discovery.DiscoveryClient
更多推荐
已为社区贡献1条内容
所有评论(0)