spring cloud微服务架构搭建(1)

一、搭建Eureka服务

1、利用maven构建工具,快速搭建spring boot项目

     http://start.spring.io/ 

1.1:(输入相关项目名称,选择相关依赖等)

 将压缩包解压到顺手的盘,用编辑器打开。

1.2:完善相关pom文件和配置文件application.properties

此处搭建的是一个Eureka服务和两个spring服务,效果如图:

生成的项目目录如下:

具体pox.xml配置和application.properties参考https://blog.csdn.net/u010938610/article/details/79282624

2、搭建过程中需要注意的问题

Spring Boot和Spring Cloud之间的版本对应关系

Spring Boot  Spring Cloud
1.2.xAngel版本
1.3.x Brixton版本
1.4.x Camden版本
1.5.x  Dalston版本、Edgware版本
2.0.xFinchley版本

 

 

 

 

 

 

 

当依赖间版本无法对应时会导致 : java.lang.NoSuchMethodError 异常,具体对应关系参考上图。

附上本人搭建时用的版本:

<parent>
 <groupId>org.springframework.boot</groupId>
 <artifactId>spring-boot-starter-parent</artifactId>
 <version>2.0.0.RELEASE</version>
 <relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencyManagement>
 <dependencies>
  <dependency>
   <groupId>org.springframework.cloud</groupId>
   <artifactId>spring-cloud-dependencies</artifactId>
   <version>Finchley.SR2</version>
   <type>pom</type>
   <scope>import</scope>
  </dependency>
 </dependencies>
</dependencyManagement>

传送门:https://search.maven.org/    查找相关版本信息

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值