本文共 3155 字,大约阅读时间需要 10 分钟。
配置pom.xml
4.0.0 org.springframework.boot spring-boot-starter-parent 2.0.8.RELEASE com.urthink.upfs upfs-register 0.0.1-SNAPSHOT upfs-register Upfs register project for Spring Boot 1.8 Finchley.SR2 org.springframework.boot spring-boot-starter org.springframework.boot spring-boot-starter-logging org.springframework.boot spring-boot-starter-log4j2 org.springframework.boot spring-boot-starter-actuator org.springframework.cloud spring-cloud-starter-netflix-eureka-server org.projectlombok lombok true org.springframework.boot spring-boot-starter-test test org.springframework.cloud spring-cloud-dependencies ${spring-cloud.version} pom import org.springframework.boot spring-boot-maven-plugin
配置application.yml
spring: application: name: upfs-registerserver: port: 8761eureka: instance: hostname: localhost client: register-with-eureka: false # 实例是否在eureka服务器上注册自己的信息以供其他服务发现,默认为true fetch-registry: false # 此客户端是否获取eureka服务器注册表上的注册信息,默认为true serviceUrl: defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
启动类
package com.urthink.upfs.register;import lombok.extern.slf4j.Slf4j;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;/** * 注册中心 * @author zhao * @date 2019.1.14 */@SpringBootApplication@EnableEurekaServer//@Slf4jpublic class UpfsRegisterApplication { public static void main(String[] args) { SpringApplication.run(UpfsRegisterApplication.class, args); System.out.println("upfs-register startup completed."); }}
访问
Eureka 开发时快速剔除失效服务
eureka 客户端springcloud service
转载地址:http://hymhd.baihongyu.com/