首页 > 其他 > 详细

4-4 Eureka环境构建

时间:2020-04-14 10:15:20      阅读:49      评论:0      收藏:0      [点我收藏+]


之前准备好的文
技术分享图片

技术分享图片
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的依赖、
技术分享图片

技术分享图片
这样在maven projects里面就可以看到了我们引入的依赖的包了。
技术分享图片

技术分享图片
这样就说明我们整个的使用环境就ok了。 

结束


4-4 Eureka环境构建

原文:https://www.cnblogs.com/wangjunwei/p/12695206.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!