如何通过起步依赖将eureka纳入Spring的框架
学会后,大家可以将其他第三方包纳入spring的管理框架
Spring-cloud-eureka与Eureka的关系
spring-cloud-eureka等基于eureka开发
通过配置类,实现eureka的接口完成spring-cloud-eureka的起步依赖
@EnableEurekaServer注解触发起步依赖配置
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Import(EurekaServerMarkerConfiguration.class)
public @interface EnableEurekaServer {
}
继承MVC适配器处理Eureka的相关请求
@Configuration
@Import(EurekaServerInitializerConfiguration.class)
@ConditionalOnBean(EurekaServerMarkerConfiguration.Marker.class)
@EnableConfigurationProperties({ EurekaDashboardProperties.class,
InstanceRegistryProperties.class })
@PropertySource("classpath:/eureka/server.properties")
public class EurekaServerAutoConfiguration extends WebMvcConfigurerAdapter {
...
}