Easymall项目分布式拆分整合(二)

本文详细介绍了Easymall项目的分布式拆分与整合过程,重点讲解了如何通过搭建Parent应用来统一管理所有子系统的依赖版本,确保系统间的兼容性。文章涵盖了SpringBoot、MySQL、MyBatis、Redis、Elasticsearch、RabbitMQ等关键技术的配置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

                              Easymall项目分布式拆分整合(二)


目录

                              Easymall项目分布式拆分整合(二)

一.Parent应用

1.作用

2.搭建步骤

1.maven的quickstart工程(simple)

2.封装成SpringBoot工程

3.修改packaging类型为pom

4.添加依赖

1.springboot的web应用简化依赖starter-web

2.common-lang3工具

5.声明式的继承依赖(dependencyManagement)

1.jdbc

2.mysql

3.mybatis

4.redis

5.elasticsearch

6.amqp(rabbitmq的依赖)

二.完整Maven父工程POM.XML依赖


一.Parent应用

1.作用

维护系统中所有jar包的版本统一,插件的集中管理,避免出现拆分独立系统各自jar包版本不同导致最终整合出现兼容问题.

2.搭建步骤

1.maven的quickstart工程(simple)

2.封装成SpringBoot工程

继承springboot-parent

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

3.修改packaging类型为pom

4.添加依赖

1.springboot的web应用简化依赖starter-web

<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-web</artifactId>

</dependency>

2.common-lang3工具

<dependency>

<groupId>org.apache.commons</groupId>

<artifactId>commons-lang3</artifactId>

<version>3.3.2</version>

</dependency>

5.声明式的继承依赖(dependencyManagement)

1.jdbc

<!-- jdbc -->

<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-jdbc</artifactId>

 <version>1.5.2.RELEASE</version>

</dependency>

2.mysql

<dependency>

<groupId>mysql</groupId>

<artifactId>mysql-connector-java</artifactId>

<version>5.1.41</version>

</dependency>

3.mybatis

<dependency>

<groupId>org.mybatis.spring.boot</groupId>

<artifactId>mybatis-spring-boot-starter</artifactId>

<version>1.3.0</version>

</dependency>

4.redis

<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-redis</artifactId>

<version>1.4.7.RELEASE</version>

</dependency>

5.elasticsearch

<dependency>

<groupId>org.elasticsearch</groupId>

<artifactId>elasticsearch</artifactId>

<version>5.5.2</version>

</dependency>

<!-- es的java客户端 TransportClient  -->

<dependency>

<groupId>org.elasticsearch.client</groupId>

<artifactId>transport</artifactId>

<version>5.5.2</version>

</dependency>

6.amqp(rabbitmq的依赖)

<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-amqp</artifactId>

<version>1.5.2.RELEASE</version>

</dependency>

二.完整Maven父工程POM.XML依赖

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>cn..tedu</groupId>
  <artifactId>springboot-parent-easymall</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>pom</packaging>

  <name>springboot-parent-easymall</name>
  <url>http://maven.apache.org</url>
     <parent>
  	<groupId>org.springframework.boot</groupId>
  	<artifactId>spring-boot-starter-parent</artifactId>
  	<version>1.5.2.RELEASE</version>
  </parent>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
    	<groupId>org.springframework.boot</groupId>
  		<artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-lang3</artifactId>
			<version>3.3.2</version>
   </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
   <dependencyManagement>
  	<!-- 声明式依赖继承 -->
  	<dependencies>
  		<!-- jdbc -->
  		<dependency>
  			<groupId>org.springframework.boot</groupId>
  			<artifactId>spring-boot-starter-jdbc</artifactId>
  			<version>1.5.2.RELEASE</version>
  		</dependency>
  		<dependency>
        	<groupId>mysql</groupId>
        	<artifactId>mysql-connector-java</artifactId>
        	<version>5.1.41</version>
   		</dependency>
   		<dependency>
        	<groupId>org.mybatis.spring.boot</groupId>
        	<artifactId>mybatis-spring-boot-starter</artifactId>
        	<version>1.3.0</version>
    	</dependency>
    	<dependency>
  		<groupId>org.springframework.boot</groupId>
  		<artifactId>spring-boot-starter-redis</artifactId>
  		<version>1.4.7.RELEASE</version>
  		</dependency>
  		<dependency>
    	<groupId>org.elasticsearch</groupId>
    	<artifactId>elasticsearch</artifactId>
    	<version>5.5.2</version>
   	 	</dependency>
    	<!-- es的java客户端 TransportClient  -->
    	<dependency>
    	<groupId>org.elasticsearch.client</groupId>
    	<artifactId>transport</artifactId>
    	<version>5.5.2</version>
    	</dependency>
    	<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-amqp</artifactId>
			<version>1.5.2.RELEASE</version>
		</dependency>
  	</dependencies>
  </dependencyManagement>
  
</project>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值