一般来说,Eureka 默认提供了一套 UI 界面,但在大多数情况下,由于 UI 风格问题并不适合直接嵌入到业务系统中使用; 本文通过扩展 Eureka 项目,实现相关的自定义接口,以便业务系统集成调用; 1. Eureka Project; <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> </dependency> @EnableEurekaServer @SpringBootApplication(scanBasePackages = "com.fastjee") public class FastjeeEurekaApplication { public static void main(String[] args) { FastjeeApplication.run(FastjeeEurekaApplication.class, args); } } 2. RESTful API package com.fastjee.eureka.rest; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.netflix.appinfo.AmazonInfo; import com.netflix.appinfo.ApplicationInfoManager; import com.netflix.appinfo.DataCenterInfo; import com.netflix.appinfo.InstanceInfo; import com.netflix.config.ConfigurationManager; import com.netflix.config.DeploymentContext; import com.netflix.discovery.shared.Application; import com.netflix.discovery.shared.Pair; import com.netflix.eureka.EurekaServerContext; import……

阅读全文