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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM