目录

项目模式

技术栈

项目架构图

模块

案例演示

主模块

zmall-common子模块

zmall-user子模块


项目模式

电商模式:市面上有5种常见的电商模式,B2B、B2C、 C2B、 C2C、O2O;

1、B2B模式 B2B (Business to Business),是指 商家与商家建立的商业关系。如:阿里巴巴

2、B2C 模式 B2C (Business to Consumer), 就是我们经常看到的供应商直接把商品卖给用户,即“商对客” 模式,也就是通常说的商业零售,直接面向消费者销售产品和服务。如:苏宁易购、京东、 天猫、小米商城

3、C2B模式 C2B(CustomertoBusiness),即消费者对企业。先有消费者需求产生而后有企业生产,即先 有消费者提出需求,后有生产企业按需求组织生产

4、C2C模式 C2C (Customer to Consumer),客户之间自己把东西放上网去卖,如:淘宝,闲鱼 5、O2O模式 O2O即Online To Ofline,也即将线下商务的机会与互联网结合在了一起,让互联网成为线 下交易的前台。线上快速支付,线下优质服务。如:饿了么,美团,淘票票,京东到家

技术栈

  • 前端 html css js jquery freemarker vue

  • 基础 javaSE javaEE

  • 框架 spring springMVC springBoot mybatis mybatis-plus

  • 安全 shiro(spring security)

  • 微服务 springCloud springCloud alibaba

  • 数据库 mysql

  • 测试 junit jmeter

项目架构图

模块

模块名 端口 名称 说明
zmall-common 公共
zmall-user 8010 用户服务
zmall-product 8020 产品服务
zmall-cart 8030 购物车服务
zmall-order 8040 订单服务
zmall-play 8050 支付服务
zmall-kill 8060 秒杀服务
zmall-gateway 8000 网关服务

案例演示

主模块

  1. 在idea中基于maven方式创建主模块zmall,创建成功之后删除src目录即可。

  2. 配置主模块pom.xml

    2.1 依赖版本锁定

<!--依赖版本的锁定-->
<properties><java.version>1.8</java.version><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding><spring-boot.version>2.3.2.RELEASE</spring-boot.version><spring-cloud.version>Hoxton.SR9</spring-cloud.version><spring-cloud-alibaba.version>2.2.6.RELEASE</spring-cloud-alibaba.version>
</properties>

2.2 dependencyManagement配置

<dependencyManagement><dependencies><!-- SpringBoot 依赖配置 --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-dependencies</artifactId><version>${spring-boot.version}</version><type>pom</type><scope>import</scope></dependency><!--spring-cloud依赖配置--><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>${spring-cloud.version}</version><type>pom</type><scope>import</scope></dependency><!--spring-cloud-alibaba依赖配置--><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-alibaba-dependencies</artifactId><version>${spring-cloud-alibaba.version}</version><type>pom</type><scope>import</scope></dependency></dependencies>
</dependencyManagement>

2.3 子模块定义

<modules><module>zmall-common</module><module>zmall-user</module>
</modules>

2.4 设置maven编译版本(先)

<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>1.8</source><target>1.8</target></configuration></plugin></plugins></build>

zmall-common子模块

  1. 基于maven方式创建zmall-common公共子模块。注:zmall-common公共模块只为其他模块提供依赖支持。

  2. 配置pom.xml

<dependencies><!-- mybatis plus依赖 --><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>3.4.0</version></dependency><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>5.1.44</version><scope>runtime</scope></dependency><dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId><version>1.2.56</version></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-freemarker</artifactId></dependency>
</dependencies>

zmall-user子模块

  1. 基于Spring Initialzr方式创建zmall-user用户模块。

  2. 配置pom.xml。设置父模块,并添加zmall-common公共模块的依赖支持。

<!-- 父模块 -->
<parent><groupId>com.ycx.zmall</groupId><artifactId>zmall</artifactId><version>1.0-SNAPSHOT</version>
</parent>
<dependencies><dependency><groupId>com.ycx.zmall</groupId><artifactId>zmall-common</artifactId><version>1.0-SNAPSHOT</version></dependency>
</dependencies>
  1. 添加登录页面及公共资源(js/css/images)

  2. 1)将资料目录中的《易买网网页素材.zip》解压后,将其中Login.html和js/css/images等等添加到项目的templates和static目录下,最好请将Login.html重命名为login.html

  3. 2)导入资料目录中的common目录到项目的templates目录下

    3)在login.html页面中的头部申明<!DOCTYPE html ....>修改成<!DOCTYPE html>(支持H5风格)

    4)在login.html页面中通过<#include>指令引入common目录中的head.html

    <#include 'common/head.html'>
    

    5)创建UserController并定义login.html页面跳转方式

@Controller
public class UserController {
​@RequestMapping("/login.html")public String login(){return "login";}
}

4.配置application.yml

server:port: 8010
spring:application:name: zmall-userdatasource:#type连接池类型 DBCP,C3P0,Hikari,Druid,默认为Hikari,HikariDataSource属于Mybatisplus依赖type: com.zaxxer.hikari.HikariDataSourcedriver-class-name: com.mysql.jdbc.Driverurl: jdbc:mysql://localhost:3306/zmall?useUnicode=true&characterEncoding=UTF-8&useSSL=falseusername: rootpassword: 123456freemarker:suffix: .htmltemplate-loader-path: classpath:/templates/mvc:static-path-pattern: /static/**

结构图:

数据库:

最终的效果图:

微服务项目框架及多模块开发相关推荐

  1. 微服务项目实战-易买网网页(电商)一、项目框架及多模块开发

    本项目会被分为多个文章去讲解实现 目录 1.项目简介 项目模式 1.B2B模式 B2B (Business to Business) 2.B2C 模式 B2C (Business to Consume ...

  2. 项目框架及多模块开发

    目录 项目模式 技术栈 项目架构图 模块 案例演示 主模块 子模块 zmall-common子模块 zmall-user子模块 项目模式 电商模式:市面上有5种常见的电商模式,B2B.B2C. C2B ...

  3. 使用Spring Cloud搭建微服务项目

    什么是Spring Clould Spring Cloud是由Spring提供的一套能够快速搭建微服务架构程序的框架集 框架集表示Spring Cloud不是一个框架,而是很多框架的统称 Spring ...

  4. java版本号管理_微服务项目中如何管理依赖版本号?

    本文是微服务项目代码组织形式三部曲中的第三篇,也是最后一篇,通过这三篇文章,相信大家对于如果组织微服务中的代码已经有了一个基本认知,前面两篇分别是: 第三篇相对来说要简单一些,本来没打算写,但是上周有 ...

  5. 业界首个Apache顶级微服务项目ServiceComb毕业,由华为捐赠

    全球最大的开源软件基金会Apache软件基金会(以下简称Apache)于北京时间10月24日宣布Apache ServiceComb 毕业成为Apache 顶级项目. \\ ServiceComb 由 ...

  6. 微服务项目中如何管理依赖版本号?

    本文是微服务项目代码组织形式三部曲中的第三篇,也是最后一篇,通过这三篇文章,相信大家对于如果组织微服务中的代码已经有了一个基本认知,前面两篇分别是: 微服务项目搭建,到底要不要聚合工程? 在微服务项目 ...

  7. 管理java版本号_微服务项目中如何管理依赖版本号?

    本文是微服务项目代码组织形式三部曲中的第三篇,也是最后一篇,通过这三篇文章,相信大家对于如果组织微服务中的代码已经有了一个基本认知,前面两篇分别是: 微服务项目搭建,到底要不要聚合工程? 在微服务项目 ...

  8. golang 比较完美的通用框架,kratos v2.0 学习,一套轻量级 Go 微服务框架,包含大量微服务相关框架及工具。涵盖了互联网开发的常用功能模块的开发库。

    目录 前言 1,关于kratos v2.0 2,Principles 原则 2,Features 特色 3,Architecture 架构 4,总结 前言 本文的原文连接是: https://blog ...

  9. java微服务项目简历_微服务框架-SpringCloud简介

    前面一篇文章谈到微服务基础框架,而Netflix的多个开源组件一起正好可以提供完整的分布式微服务基础架构环境,而对于Spring Cloud正是对Netflix的多个开源组件进一步的封装而成,同时又实 ...

最新文章

  1. html5语音对讲,c#语音对讲demo
  2. Python 继承标准类时发生了什么
  3. js简单的条件语句判断
  4. 不抓包,如何学得了 TCP
  5. matlab怎么连接服务器,matlab安装小坑----连接不上服务器
  6. 自己动手写CPU(8)加载存储指令的实现
  7. 网络流--最大流--HDU 3549 Flow Problem
  8. 语义分割深度学习方法集锦
  9. python网络编程---TCP服务器
  10. ICPC程序设计题解书籍系列之九:罗勇军《算法竞赛入门到进阶》
  11. CodeVS 1576 最长严格上升子序列 (DP)
  12. 微信小游戏flappy bird填坑
  13. mybatis generator 使用文档
  14. 杀戮尖塔 地图生成器参考
  15. RuntimeError: Expected 4-dimensional input for 4-dimensional weight [32, 1, 5, 5]
  16. 国内常用开源镜像站点【推荐使用阿里巴巴开源镜像站】
  17. 三台路由器两台计算机华为,两台华为路由器怎样设置桥接 两台华为路由器设置桥接的方法...
  18. LYOI 78 小澳的葫芦
  19. 大象装企营销:有的装修公司的生意为什么越做越差?
  20. word里贴代码神器(不需要下载)

热门文章

  1. 情感分类---未解决
  2. iPhone X用户需要知道的12个隐藏小技巧 条条实用
  3. 中国招聘网站2007春调研报告(from 搜索引擎项目)
  4. 7月30日科技资讯|网易游戏回应裁员 10%;字节跳动秘密研发手机;iOS 13 beta 5 发布
  5. BoT-SORT: Robust Associations Multi-Pedestrian Tracking 论文详细解读
  6. association内属性及作用
  7. H5C3新特性简单总结
  8. 2019年517吃货节微信营销活动玩法
  9. 沈阳工业大学c语言编程题,金融工程专业《C语言程序设计》启发式教学探讨
  10. 破解数字化转型困局,企业分析协同场景案例解析