Controller required a bean of type 'com.netflix.discovery.DiscoveryClient' that could not be found.异常处理

注入代码如下:

@Autowired
private DiscoveryClient discoveryClient;

导入的包如下com.netflix.discovery,这个包是错误的,DiscoveryClient有两个包

应该导入import org.springframework.cloud.client.discovery.DiscoveryClient
posted on 2018-11-18 22:36  supress_Elon_Musk  阅读(2896)  评论(0编辑  收藏  举报