当前位置:   article > 正文

eureka(一:服务端启动)_eureka服务端启动

eureka服务端启动

一:建立一个springboot模块
在这里插入图片描述

二:pom.xml 加入

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
  • 1
  • 2
  • 3
  • 4

三:启动类加注解@EnableEurekaServer

@SpringBootApplication
@EnableEurekaServer
public class EurekaMain7001
{
    public static void main( String[] args )
    {
        SpringApplication.run(EurekaMain7001.class,args);
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

四 配置文件yml

server:
  port: 7001 #服务端口
eureka:
  instance:
    hostname: localhost
  client:
    register-with-eureka: false
    fetch-registry: false
    service-url:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

五:启动项目,结果如下则成功
在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/839024
推荐阅读
相关标签
  

闽ICP备14008679号