You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spring Cloud Commons provides the @EnableDiscoveryClient annotation. This looks for implementations of the DiscoveryClient interface with META-INF/spring.factories. Implementations of the Discovery Client add a configuration class to spring.factories under the org.springframework.cloud.client.discovery.EnableDiscoveryClient key. Examples of DiscoveryClient implementations include Spring Cloud Netflix Eureka, Spring Cloud Consul Discovery, and Spring Cloud Zookeeper Discovery.
By default, implementations of DiscoveryClient auto-register the local Spring Boot server with the remote discovery server. This behavior can be disabled by setting autoRegister=false in @EnableDiscoveryClient.
@EnableDiscoveryClient is no longer required. You can put a DiscoveryClient implementation on the classpath to cause the Spring Boot application to register with the service discovery server.
正在为spring cloud alibaba系列博客攒搞,发现@EnableDiscoveryClient有点问题。故而提出。
在Spring Cloud官方文档中,从Edgware开始,已经不再强制在启动类上添加@EnableDiscoveryClient注解了。
原文如下:
而个人测试时发现,如果用Nacos作为服务发现,客户端不添加EnableDiscoveryClient 注解,应用启动都启动不了。这点不太符合官方的规划。
之所以不需要加EnableDiscoveryClient的动机,我在书里也有描述:
The text was updated successfully, but these errors were encountered: