创建新的 Maven Module 工程。
POM 中 引入依赖:
依赖版本要对应。不然会 jar 包冲突。
引入 Eureka Client 所需的依赖:

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
            <version>2.0.1.RELEASE</version>
        </dependency>

引入 web 功能的起步依赖:spring-boot-starter-test

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

引入 Spring Boot 测试的起步依赖:spring-boot-starter-test

        <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>

配置 application.yml
做 Eureka Client 的相关配置:
有程序名,端口号,服务注册地址。

eureka:
  client:
    service-url:
      defaultZone: http://localhost:8761/eureka/
server:
  port: 8762
spring:
  application:
    name: eureka-client

最后在 工程的启动类上加注解 @EnableEurekaClient 开启 Eureka Client 功能

@EnableEurekaClient

启动服务后,就可以在注册中心的 Eureka Server 主页 看到注册的实例。