springcloud中@EnableDiscoveryClient与@EnableEurekaClient的区别
Posted 永不宕机
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了springcloud中@EnableDiscoveryClient与@EnableEurekaClient的区别相关的知识,希望对你有一定的参考价值。
@EnableDiscoveryClient和@EnableEurekaClient注解都是向服务注册中心进行注册。
@EnableDiscoveryClient基于spring-cloud-commons,@EnableEurekaClient基于spring-cloud-netflix。
另外,@EnableEurekaClient具有@EnableDiscoveryClient的功能,而且更加针对于注册中心为Eureka的服务。以下是@EnableEurekaClient注解的源码
/** * Convenience annotation for clients to enable Eureka discovery configuration * (specifically). Use this (optionally) in case you want discovery and know for sure that * it is Eureka you want. All it does is turn on discovery and let the autoconfiguration * find the eureka classes if they are available (i.e. you need Eureka on the classpath as * well). * * @author Dave Syer * @author Spencer Gibb */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited @EnableDiscoveryClient public @interface EnableEurekaClient { }
以上是关于springcloud中@EnableDiscoveryClient与@EnableEurekaClient的区别的主要内容,如果未能解决你的问题,请参考以下文章