idea搭建springCloud----搭建父子项目(二)

今天介绍一下 : idea 搭建父子项目

父项目:springCloud_ht

子项目:eureka_server(注册中心)

1-1.新建父项目:

 1-2 起名称 springCloud_ht

 1-3 什么都不选,next

 1-4 :起项目名称:springCloud_ht

 

1-5: 该目录为下图,但是项目为红色,我不喜欢红色,去除红色(将svn删掉,刷新即可)

1-6 :删除不必要的文件

2 创建子项目

2-1 创建maven模块

2-2  创建子项目:

 2-3  创建项目名:eureka_server

2-4:选择:spring web Starter 和  eureka server

2-5  起项目名:

2-6 项目路径:

2-7 点击pom.xml 添加为maven项目

2-8 :查看项目:

 2-9   将注解:@EnableEurekaServer  添加到  EurekaServerApplication 类上

2-10  完善配置文件: application.yml

server:
  port: 8761

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

2-11  启动main方法,访问路径:http://localhost:8761/

 注意:现在其实还没有父子相连!!!!

在父pom.xml文件中添加:

<modules>
<module>子项目名称</module>
</modules>

在子pom.xml文件中添加:

<parent>
<groupId>父组信息</groupId>
<artifactId>父名称</artifactId>
<version>父版本</version>
</parent>

现在就可以重新启动了,父子之间可以对应了

搭建过程可以参考   方志朋的博客:https://www.fangzhipeng.com/springcloud/2017/06/01/sc01-eureka.html

 

 

 

转载于:https://www.cnblogs.com/zongguitao/p/11214072.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值