栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Springcould多模块搭建Eureka服务器端口过程详解

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Springcould多模块搭建Eureka服务器端口过程详解

这篇文章主要介绍了Springcould多模块搭建Eureka服务器端口过程详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下

1创建一个普通父maven

在pom修改为因为spring could依赖spring boot所以首先在父maven

  
    org.springframework.boot
    spring-boot-starter-parent
    2.0.5.RELEASE
  

    UTF-8
    UTF-8
    1.8
    Finchley.SR1
  

引入依赖


    
      
 org.springframework.cloud
 spring-cloud-dependencies
 ${spring-cloud.version}
 pom
 import
      
    
  


  
    
      junit
      junit
      4.12
      test
    
  

2.创建一个Eureka1000

把在父项目中有的删掉,添加依赖


    
      org.springframework.cloud
      spring-cloud-starter-netflix-eureka-server
    
    
      org.springframework.boot
      spring-boot-starter-web
    
  

3.在Eureka1000中创建resources并且写入Java文件

resources

application.yml

server:
 port: 1000 #端口号

eureka:
 instance:
  hostname: localhost
 client:
  registerWithEureka: false
  fetchRegistry: false
  serviceUrl:
   defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

主配置类

package cn.jiedada;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;

@SpringBootApplication
@EnableEurekaServer
public class Application {

  public static void main(String[] args) {
    new SpringApplicationBuilder(Application.class).web(true).run(args);
  }

}

运行出现

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/136117.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号