eureka:
instance:
hostname: localhost # eureka 服务端的实例名称
client:
register-with-eureka: false # 是否向 eureka 注册自己,不注册自己
fetch-registry: false # fetch-registry 如果为false,表现自己为注册中心
service-url: # 将默认的url去掉,更换为自己的,监控页面
defaultZone: http:// e u r e k a . i n s t a n c e . h o s t n a m e : {eureka.instance.hostname}: eureka.instance.hostname:{server.port}/eureka/
**启动类**
复制代码
package com.wanshi.springcloud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
// EnableEurekaServer 启动Eureka服务
@EnableEurekaServer
public class EurekaServerMainApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaServerMainApplication.class, args);
}
}