一 项目基本模板结构

sdgt_parent:根目录,管理子模块。

common:公共模块父节点

common-util:工具类模块,所有模块都可以依赖于它

service-util:service服务的工具包,包含 service服务的公共配置类,所有 service 模块依赖于它

model:实体类模块

service:api 接口服务父节点

二 构建父工程(sdgt_parent)

1 该工程是 Spring Boot 项目

2 它对应的 pom 配置如下

<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><modules><module>common</module><module>model</module><module>service</module></modules><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.2.1.RELEASE</version> <!-- 用该版本 --><relativePath/> </parent><!-- 项目坐标 --><groupId>com.baiyee</groupId><artifactId>sdgt_parent</artifactId><packaging>pom</packaging><version>0.0.1-SNAPSHOT</version><name>sdgt_parent</name><description>Demo project for Spring Boot</description><!-- 版本属性 --><properties><java.version>1.8</java.version><cloud.version>Hoxton.RELEASE</cloud.version><alibaba.version>2.2.0.RELEASE</alibaba.version><mybatis-plus.version>3.3.1</mybatis-plus.version><mysql.version>5.1.46</mysql.version><swagger.version>2.7.0</swagger.version><jwt.version>0.7.0</jwt.version><fastjson.version>1.2.29</fastjson.version><httpclient.version>4.5.1</httpclient.version><easyexcel.version>2.2.0-beta2</easyexcel.version><aliyun.version>4.1.1</aliyun.version><oss.version>3.9.1</oss.version><jodatime.version>2.10.1</jodatime.version></properties><!-- 配置 dependencyManagement 锁定依赖的版本 --><dependencyManagement><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>${cloud.version}</version><type>pom</type><scope>import</scope></dependency><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-alibaba-dependencies</artifactId><version>${alibaba.version}</version><type>pom</type><scope>import</scope></dependency><!-- mybatis-plus 持久层--><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>${mybatis-plus.version}</version></dependency><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>${mysql.version}</version></dependency><!-- swagger --><dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger2</artifactId><version>${swagger.version}</version></dependency><!-- swagger ui--><dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger-ui</artifactId><version>${swagger.version}</version></dependency><dependency><groupId>io.jsonwebtoken</groupId><artifactId>jjwt</artifactId><version>${jwt.version}</version></dependency><dependency><groupId>org.apache.httpcomponents</groupId><artifactId>httpclient</artifactId><version>${httpclient.version}</version></dependency><dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId><version>${fastjson.version}</version></dependency><dependency><groupId>com.alibaba</groupId><artifactId>easyexcel</artifactId><version>${easyexcel.version}</version></dependency><dependency><groupId>com.aliyun</groupId><artifactId>aliyun-java-sdk-core</artifactId><version>${aliyun.version}</version></dependency><dependency><groupId>com.aliyun.oss</groupId><artifactId>aliyun-sdk-oss</artifactId><version>${oss.version}</version></dependency><!-- 日期时间工具 --><dependency><groupId>joda-time</groupId><artifactId>joda-time</artifactId><version>${jodatime.version}</version></dependency></dependencies></dependencyManagement><!-- 项目打包时会将 java 录中的 *.xml 文件也进行打包 --><build><resources><resource><directory>src/main/java</directory><includes><include>**/*.xml</include></includes><filtering>false</filtering></resource></resources></build>
</project>

三 搭建 common 父模块

1 该项目是 maven 项目

2 pom 文件如下

<?xml version="1.0" encoding="UTF-8"?>
<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"><!-- 该项目父项目对应坐标 --><parent><artifactId>sdgt_parent</artifactId><groupId>com.baiyee</groupId><version>0.0.1-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><!-- 该项目坐标 --><artifactId>common</artifactId><packaging>pom</packaging><!-- 该项目的子模块 --><modules><module>common_util</module><module>service_util</module></modules><!-- 该项目依赖 --><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId><scope>provided</scope></dependency><!-- mybatis-plus --><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><scope>provided</scope></dependency><!-- lombok 用来简化实体类:需要安装 lombok 插件 --><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></dependency><!-- swagger --><dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger2</artifactId></dependency><dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger-ui</artifactId></dependency><dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId></dependency></dependencies>
</project>

四 搭建 common-util 模块

1 该项目是 maven 项目

2 对应的 pom 文件

<?xml version="1.0" encoding="UTF-8"?>
<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"><!-- 该项目父项目坐标 --><parent><artifactId>common</artifactId><groupId>com.baiyee</groupId><version>0.0.1-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><!-- 该项目坐标 --><artifactId>common_util</artifactId><!-- 该项目依赖 --><dependencies><dependency><groupId>joda-time</groupId><artifactId>joda-time</artifactId></dependency><dependency><groupId>io.jsonwebtoken</groupId><artifactId>jjwt</artifactId></dependency><dependency><groupId>org.apache.httpcomponents</groupId><artifactId>httpclient</artifactId></dependency></dependencies>
</project>
3 一些必要的公共工具类
SdgtException
自定义全局异常
Result
API统一返回结果封装类
ResultCodeEnum
API统一返回结果状态信息
MD5
MD5加密工具类

五 搭建 service-util 模块

1 该模块是 maven 项目

2 对应的 pom 文件

<?xml version="1.0" encoding="UTF-8"?>
<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"><!-- 该项目父项目坐标 --><parent><artifactId>common</artifactId><groupId>com.baiyee</groupId><version>0.0.1-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><!-- 该项目坐标 --><artifactId>service_util</artifactId><!-- 项目依赖 --><dependencies><dependency><groupId>com.baiyee</groupId><artifactId>common_util</artifactId><version>0.0.1-SNAPSHOT</version></dependency><!-- redis --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency><!-- spring2.X 集成 redis 所需 common-pool2 --><dependency><groupId>org.apache.commons</groupId><artifactId>commons-pool2</artifactId><version>2.6.0</version></dependency></dependencies>
</project>

六 搭建 model 模块

1 该模块是 maven 项目

2 对应的 pom 文件

<?xml version="1.0" encoding="UTF-8"?>
<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"><!-- 该项目父项目坐标 --><parent><artifactId>sdgt_parent</artifactId><groupId>com.baiyee</groupId><version>0.0.1-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><!-- 该项目坐标 --><artifactId>model</artifactId><!-- 依赖 --><dependencies><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></dependency><!--mybatis-plus--><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><scope>provided</scope></dependency><!--swagger--><dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger2</artifactId><scope>provided</scope></dependency><dependency><groupId>com.alibaba</groupId><artifactId>easyexcel</artifactId><scope>provided</scope></dependency><dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId><scope>provided</scope></dependency></dependencies>
</project>

七 搭建service父模块

1 该模块是 maven 项目

2 对应的 pom 文件

<?xml version="1.0" encoding="UTF-8"?>
<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"><parent><artifactId>sdgt_parent</artifactId><groupId>com.baiyee</groupId><version>0.0.1-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><artifactId>service</artifactId><packaging>pom</packaging><modules><module>service_hosp</module></modules><dependencies><dependency><groupId>com.baiyee</groupId><artifactId>model</artifactId><version>0.0.1-SNAPSHOT</version></dependency><dependency><groupId>com.baiyee</groupId><artifactId>service_util</artifactId><version>0.0.1-SNAPSHOT</version></dependency><!-- web --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!-- mybatis-plus --><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId></dependency><!-- mysql --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId></dependency><!-- 开发者工具 --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-devtools</artifactId><optional>true</optional></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins><resources><resource><directory>src/main/java</directory><includes><include>**/*.yml</include><include>**/*.properties</include><include>**/*.xml</include></includes><filtering>false</filtering></resource><resource><directory>src/main/resources</directory><includes><include>**/*.yml</include><include>**/*.properties</include><include>**/*.xml</include></includes><filtering>false</filtering></resource></resources></build>
</project>

微服务基础模块搭建过程相关推荐

  1. 电商系统开发实战-用户微服务基础模块开发

    电商系统开发实战-用户微服务基础模块开发 1.用户微服务项目开发之收货地址查询接口开发 1.1 配置文件配置 application.yml server:port: 9001spring:appli ...

  2. Spring Cloud 进阶--Rest 微服务基础模块构建

    < Rest 微服务基础模块构建 > 前言 前面进行了微服务架构风格.微服务框架以及微服务相关的理论体系的简介与介绍,本篇博文是微服务实践的开始,本篇博客主要为完成 Rest 微服务基础模 ...

  3. SpringCloud微服务基础 Eureka、Feign、Ribbon、Zuul、Hystrix、配置中心的基础使用

    1.单点系统架构 传统项目架构 传统项目分为三层架构,将业务逻辑层.数据库访问层.控制层放入在一个项目中. 优点:适合于个人或者小团队开发,不适合大团队开发. 分布式项目架构 根据业务需求进行拆分成N ...

  4. 企业级微服务构建-01搭建和使用Maven私有仓库(Nexus)-03备份和恢复

    亲历的企业级微服务的完整构建过程-系列文章目录 本人参与了这次的企业级微服务的完整构建,想要记录下来以便以后复习,同时也想分享给小伙伴们,抛砖引玉,欢迎大家提出自己的意见和建议,大家一起探讨一起成长. ...

  5. 企业级微服务构建-01搭建和使用Maven私有仓库(Nexus)-05仓库管理

    亲历的企业级微服务的完整构建过程-系列文章目录 本人参与了这次的企业级微服务的完整构建,想要记录下来以便以后复习,同时也想分享给小伙伴们,抛砖引玉,欢迎大家提出自己的意见和建议,大家一起探讨一起成长. ...

  6. 企业级微服务构建-01搭建和使用Maven私有仓库(Nexus)-09权限(Privileges)

    亲历的企业级微服务的完整构建过程-系列文章目录 本人参与了这次的企业级微服务的完整构建,想要记录下来以便以后复习,同时也想分享给小伙伴们,抛砖引玉,欢迎大家提出自己的意见和建议,大家一起探讨一起成长. ...

  7. 企业级微服务构建-01搭建和使用Maven私有仓库(Nexus)-17审计

    亲历的企业级微服务的完整构建过程-系列文章目录 本人参与了这次的企业级微服务的完整构建,想要记录下来以便以后复习,同时也想分享给小伙伴们,抛砖引玉,欢迎大家提出自己的意见和建议,大家一起探讨一起成长. ...

  8. 企业级微服务构建-01搭建和使用Maven私有仓库(Nexus)-29上传组件

    亲历的企业级微服务的完整构建过程-系列文章目录 本人参与了这次的企业级微服务的完整构建,想要记录下来以便以后复习,同时也想分享给小伙伴们,抛砖引玉,欢迎大家提出自己的意见和建议,大家一起探讨一起成长. ...

  9. Java的微服务基础

    微服务基础 前面我们讲解了SpringBoot框架,通过使用SpringBoot框架,我们的项目开发速度可以说是得到了质的提升.同时,我们对于项目的维护和理解,也会更加的轻松. 可见,SpringBo ...

最新文章

  1. java 跨域_springboot解决跨域CROS问题,用注解@CrossOrigin
  2. AndoridSQLite数据库开发基础教程(8)
  3. Codeforces 1004F Sonya and Bitwise OR (线段树)
  4. Django框架深入了解_05 (Django中的缓存、Django解决跨域流程(非简单请求,简单请求)、自动生成接口文档)(一)
  5. 图像色调,饱和度,对比度等相关定义
  6. nssl1438-战略威慑【枚举,树的直径】
  7. leetcode590. N叉树的后序遍历
  8. maven 总结整理(二)——download source code
  9. java异步文件读写文件,Java AsynchronousFileChannel和Future读取文件
  10. 基于ansys命令流的水池静力学分析
  11. js输入身份证号直接转换时间
  12. GitHub 上有哪些一般人也可以用的项目?
  13. PGP验证数字签名原理
  14. DotNet 资源大全(转)
  15. 毛笔字软件测试简历,写字测试
  16. 中文版-Plan9汇编器手册-A Manual for the Plan 9 assembler
  17. AI挖掘优质淘宝买家秀 再也不用担心辣眼睛了
  18. Linux版本_Linux版本说明及应用领域
  19. 推荐系统之NFM原理与实现学习
  20. C语言 弹小球 小游戏(控制台)

热门文章

  1. 高物实验报告计算机模拟高分子,高分子物理实验 [闫红强 编] 2012年版
  2. 一对一直播系统源码开发,礼物打赏中追加、连击等功能的实现
  3. php 保存tmp,tmp文件是什么
  4. 如何选择我们的损失函数 - 连接统计推断和问题所在领域的桥梁
  5. ROS python编程
  6. python解决警告InsecureRequestWarning: unverified HTTPS request is being made to host
  7. SpringBoot网上商城(源代码+数据库)014
  8. 论文阅读: 图像分类中的注意力机制(attention)
  9. 脑科学读物阅读笔记系列 - 拉马钱德兰《脑中魅影》- 3.追踪幻影
  10. Qt OpenGL 位图字体