第一步:创建项目
第二步: 启动类添加注解 @EnableEurekaServer
@SpringBootApplication @EnableEurekaServer public class Application { public static void main(String[] args) { new SpringApplicationBuilder(Application.class).web(true).run(args); } }
第三步:增加配置application.yml
server: port: 8761 eureka: instance: hostname: localhost client: #声明自己是个服务端 registerWithEureka: false fetchRegistry: false serviceUrl: defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
第四步:访问注册中心页面
http://localhost:8761/