09-Eureka-搭建eureka服务

  1. 创建spring boot项目
  2. 修改spring boot版本与JDK版本(与其他微服务版本保持一致)
  3. 添加eureka依赖
  4. <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
                <version>2.2.7.RELEASE</version>
    </dependency>
    
  5. 启动类新增@EnableEurekaServer
  6. 作为Eureka服务端改写application.yml配置文件
  7. server:
      port: 10086
    spring:
      application:
        name: eureka-server-master
    
  8. 作为一个微服务改写application.yml配置文件
  9. 因为它作为单独的一个微服务也需要注册到eureka里面去
    eureka:
      client:
        service-url:
          defaultZone: http://127.0.0.1:10086/eureka
      dashboard:
        path: eurekaTemplate
    

posted @ 2023-08-06 22:30  356a  阅读(5)  评论(0编辑  收藏  举报