• 4-4 Eureka环境构建



    之前准备好的文本


    SpringCloud 依赖:
    
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${last.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    
    ==============================================
    
    Eureka Server:
    
    pom dependency:
    
        <dependency>
          <groupId>org.springframework.cloud</groupId>
          <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
      </dependency>
        
    properties:
    
    server:
        port: 8761
    
    eureka:
        instance:
            hostname: localhost
            prefer-ip-address: true
        client:
            register-with-eureka: false
            fetch-registry: false
        service-url:
            defaultZone: http://localhost:8761/eureka/
            
            
    Eureka Client:
    
    pom dependency:
    
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    </dependency>
    
    
    properties:
    
    server:
        port: 8201
    
    eureka:
        client:
            service-url:
                defaultZone: http://localhost:8761/eureka/
    
        
    spring:
        application:
            name: helloService
    Eureka配置依赖

    新建模块

    先复制一下我们的groupId




      
    eurekaServer需要我们开发的不多,它仅仅是只需要这么个模块。

    这里也什么不选,一会把配置文件复制进来。大家看下效果就可以了。

    都换成下划线

    没用的先删掉

    因为不存在开发,所以test删除。

    配置文件修改成yml的格式


    复制parent部分

    放到我们的这里

    删除Srping boot和test的相关依赖项

    不会作为web依赖引入,只会作为一个单独的服务去提供。

    父节点引入这个模块


    这样eureka模块默认就有了这几个的引用,因为父模块已经有了。

    那么他的dependency自然也就有这一项Srping cloud了。

    这样就代表了 我们配置文件中第一项就做好了。

    下面要做的就是复制eureka-server的依赖、

    复制过来后,右下角,记得Import Packages。导入这些包

    这样在maven projects里面就可以看到了我们引入的依赖的包了。



    这样就说明我们整个的使用环境就ok了。 

    结束


  • 相关阅读:
    前台隐藏或者看不见
    关于线程安全
    JAVA中的length属性和length()方法和size()方法的区别
    内存泄露和内存溢出
    配置tomcat,只需要启动一次
    ThickBox关闭本页,刷新父页
    Myeclipse断点问题
    解决windows远程(Telnet)最大连接数的问题
    父页刷新的方法
    Jsp页面大小写转换
  • 原文地址:https://www.cnblogs.com/wangjunwei/p/12695206.html
Copyright © 2020-2023  润新知