码迷,mamicode.com
首页 > 编程语言 > 详细

springcloud中@EnableDiscoveryClient与@EnableEurekaClient的区别

时间:2018-06-15 13:20:57      阅读:275      评论:0      收藏:0      [点我收藏+]

标签:author   sse   cloud   eureka   over   retention   hat   specific   you   

@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的区别

标签:author   sse   cloud   eureka   over   retention   hat   specific   you   

原文地址:https://www.cnblogs.com/zhlblogs/p/9186319.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!