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
原文地址:https://www.cnblogs.com/zxq-Study-Java/p/9980108.html