基于微服务的系统搭建-简介

主要内容

1. 项目构建思想

项目具体的构建思想是底层技术和业务低耦合。具体是将微服务依赖的服务中心和业务逻辑分为两个工程创建。微服务依赖主要包括配置中心,集群式服务注册中心,服务监控,服务跟踪模块等。业务实现使用其他工程创建,具体也是使用模块化,此处的模块化是将控制器,业务逻辑,数据映射分为三个模块。这里主要是介绍一下项目的思想。文中使用的代码不是全部的构建代码

2. 微服务父级工程配置

微服务每个工程模块均依赖一个父级可以减少很多版本不匹配造成的困扰。在父级pom中指定使用的SpringBoot和SpringCloud版本。
如下:

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>1.4.4.RELEASE</version>
	</parent>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-dependencies</artifactId>
				<version>Camden.SR5</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>

项目依赖的公共jar包可以放到<dependencies>中,这里我们主要使用springboot-starter构建基于springboot的应用。如下:

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

之后我们构建模块时就不必引入上述依赖。中管理了springcloud版本,当我们使用springcloud的模块的时候不必指定版本号。

END

之后会依次介绍如何构建服务配置中心,服务注册中心等模块。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值