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

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

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

1创建一个普通父maven

在pom修改为因为spring Could依赖spring boot所以首先在父mavenorg.springframework.bootspring-boot-starter-parent2.0.5.RELEASEUTF-8UTF-81.8Finchley.SR1引入依赖org.springframework.cloudspring-cloud-dependencies${spring-cloud.version}pomimportjunitjunit4.12test2.创建一个Eureka1000

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

org.springframework.cloudspring-cloud-starter-netflix-eureka-serverorg.springframework.bootspring-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); } }

运行出现

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

相关文章

HashMap是Java中最常用的集合类框架,也是Java语言中非常典型...
在EffectiveJava中的第 36条中建议 用 EnumSet 替代位字段,...
介绍 注解是JDK1.5版本开始引入的一个特性,用于对代码进行说...
介绍 LinkedList同时实现了List接口和Deque接口,也就是说它...
介绍 TreeSet和TreeMap在Java里有着相同的实现,前者仅仅是对...
HashMap为什么线程不安全 put的不安全 由于多线程对HashMap进...