zoukankan      html  css  js  c++  java
  • 测试环境

    Eureka环境搭建

    1. 下载镜像

      docker pull springcloud/eureka
      

    2. 运行镜像

      docker run -dit --name eureka -p 8080:8761  springcloud/eureka:latest
      

    3. 查看网页

    IDEA搭建SpringBootgong工程

    1. 新建Spring Boot工程

    2. 修改pom文件
      1)调整版本为2.0.1.RELEASE

       <parent>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-starter-parent</artifactId>
           <version>2.0.1.RELEASE</version>
           <relativePath/> <!-- lookup parent from repository -->
       </parent>
      

      2)添加Cloud的相关依赖

      <dependencyManagement>
           <dependencies>
               <dependency>
                   <groupId>org.springframework.cloud</groupId>
                   <artifactId>spring-cloud-dependencies</artifactId>
                   <version>Finchley.SR1</version>
                   <type>pom</type>
                   <scope>import</scope>
               </dependency>
           </dependencies>
       </dependencyManagement>
      

      3)增加相关依赖

      <dependency>
          <groupId>org.springframework.cloud</groupId>
          <artifactId>spring-cloud-starter-openfeign</artifactId>
      </dependency>
      
      <dependency>
          <groupId>org.springframework.cloud</groupId>
          <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
      </dependency>
      

      4)修改项目配置文件,增加eureka相关配置

      spring:
        application:
          name: omm
      eureka:
        client:
          registerWithEureka: false
          fetchRegistry: false
          service-url:
            defaultZone: http://localhost:8080/eureka
      server:
        port: 9090
      

      5)添加启动参数

      @EnableEurekaClient
      

      6)启动服务

      7)查看注册结果

  • 相关阅读:
    java System.getProperty()参数大全
    元类(转自https://zhuanlan.zhihu.com/p/23887627)
    正则(高级)(转)
    正则(转)
    机器学习入门之房价预测(线性回归)
    python字节码(转)
    在虚拟机中搭建django,通过外网访问
    django框架入门
    linux下创建虚拟环境(转)
    PAT1005
  • 原文地址:https://www.cnblogs.com/just4life/p/14291538.html
Copyright © 2011-2022 走看看