When using the service discovery, two kinds of annotations are mentioned, one is @enablediscoveryclient, one is @enableeurekaclient, the usage is basically the same, and today it is the same. The following is an explanation of the two found above from StackOverflow:
" Discovery Service "
in Spring-cloud-commons and picks the implementation on the classpath.
inch for is on your classpath, they is effectively the same.
The original address is: What ' s the difference between enableeurekaclient and enablediscoveryclient?
There are many implementations of discovery service in spring Cloud (Eureka, Consul, zookeeper, and so on), @ Enablediscoveryclient based on Spring-cloud-commons, @EnableEurekaClient based on Spring-cloud-netflix.
In fact, in a simpler words, if you choose the registration center is Eureka, then recommend @enableeurekaclient, if it is another registry, then recommend the use of @enablediscoveryclient.
Note @enableeurekaclient on the @enablediscoveryclient annotation, it can be said that the basic is Enableeurekaclient has @enablediscoveryclient function,
Also mentioned in the above note, in fact * * @EnableEurekaClient **z annotation is a convenient use of Eureka annotations, you can say that the use of other registries,
can use @enablediscoveryclient annotations, but using the @enableeurekaclient scenario is a single use scenario when the service takes Eureka as the registry.
@EnableEurekaClient
Our specific @enableeurekaclient of the source code to look at, as follows:
/** * convenience annotation for clients to Enable Eureka Discovery Configuration * (specifically). Use this (optionally) in the case you want discovery and know for sure that * it's Eureka you want. All it does was turn on discovery and let the autoconfiguration * Find the Eureka classes if they be available (i.e. you n Eed Eureka on the classpath as * well). * * @author Dave Syer * @author Spencer Gibb */ @Target (elementtype.type) @Retention (retentionpolicy.runtime) @ Documented@inherited@enablediscoveryclient public @interface enableeurekaclient {}
Spring Cloud Service discovery annotations @enablediscoveryclient and @enableeurekaclient