JAVA全系列 教程
3762个小节阅读:7093.4k
目录
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
使用Dubbo时,服务的生产者和消费者都要引入服务接口,所以我们构建一个通用模块,在通用模块中存放Dubbo服务接口,服务的生产者和消费者都会引用该模块。除了服务接口,我们还会存放一些实体类、工具类等通用功能,每个模块都会引用通用模块。
创建名为shopping_common
的SpringBoot工程,添加相关依赖。
xxxxxxxxxx
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- MyBatisPlus -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
设置该工程的父工程为shopping
。
xxxxxxxxxx
<parent>
<groupId>com.itbaizhan</groupId>
<artifactId>shopping</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
给shopping
工程设置通用子模块
xxxxxxxxxx
<!-- 子模块 -->
<modules>
<!-- 通用模块,包含实体类、服务接口、工具类等 -->
<module>shopping_common</module>
</modules>
创建pojo文件夹,编写实体类。
创建名为baizhanshopping的数据库,将数据库脚本导入mysql中。
在通用模块添加service
包存放服务接口,添加util
包存放工具类。