1、springboot+mybatis+zookeeper+dubbox+maven+pagehelper
一、创建普通的maven的web项目
2、配置KD42WF_Part1下的pom.xml
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 <?xml version="1.0" encoding="UTF-8"?> 2 3 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 5 <modelVersion>4.0.0</modelVersion> 6 7 <groupId>cn.kgc</groupId> 8 <artifactId>KD42WF_Part1</artifactId> 9 <version>1.0-SNAPSHOT</version> 10 <packaging>war</packaging> 11 12 <name>KD42WF_Part1 Maven Webapp</name> 13 <!-- FIXME change it to the project's website --> 14 <url>http://www.example.com</url> 15 <dependencies> 16 <!--配置springboot分页插件--> 17 <dependency> 18 <groupId>com.github.pagehelper</groupId> 19 <artifactId>pagehelper-spring-boot-starter</artifactId> 20 <version>1.2.3</version> 21 </dependency> 22 </dependencies> 23 24 25 26 27 </project>
二、common模块: 在项目下创建一个空的maven的普通工程的子common模块
3、在Common模块下创建实体类Classes.java
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 package cn.kgc.pojo; 2 import java.io.Serializable; 3 /** 4 * 持久化类一定要进行序列化,否则请求数据时会报错 5 */ 6 public class Classes implements Serializable{ 7 private Integer cid; 8 private String cname; 9 10 public Classes() { 11 } 12 13 public Classes(Integer cid, String cname) { 14 this.cid = cid; 15 this.cname = cname; 16 } 17 18 public Integer getCid() { 19 return cid; 20 } 21 22 public void setCid(Integer cid) { 23 this.cid = cid; 24 } 25 26 public String getCname() { 27 return cname; 28 } 29 30 public void setCname(String cname) { 31 this.cname = cname; 32 } 33 34 @Override 35 public String toString() { 36 return "Classes{" + 37 "cid=" + cid + 38 ", cname='" + cname + '\'' + 39 '}'; 40 } 41 }
4、在Common模块下创建实体类Student.java
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 package cn.kgc.pojo; 2 public class Student { 3 private Integer sid; 4 private String sname; 5 private String password; 6 private String subject; 7 private Double score; 8 private Classes classes; 9 10 public Student() { 11 } 12 13 public Student(Integer sid, String sname, String password, String subject, Double score, Classes classes) { 14 this.sid = sid; 15 this.sname = sname; 16 this.password = password; 17 this.subject = subject; 18 this.score = score; 19 this.classes = classes; 20 } 21 22 public Integer getSid() { 23 return sid; 24 } 25 26 public void setSid(Integer sid) { 27 this.sid = sid; 28 } 29 30 public String getSname() { 31 return sname; 32 } 33 34 public void setSname(String sname) { 35 this.sname = sname; 36 } 37 38 public String getPassword() { 39 return password; 40 } 41 42 public void setPassword(String password) { 43 this.password = password; 44 } 45 46 public String getSubject() { 47 return subject; 48 } 49 50 public void setSubject(String subject) { 51 this.subject = subject; 52 } 53 54 public Double getScore() { 55 return score; 56 } 57 58 public void setScore(Double score) { 59 this.score = score; 60 } 61 62 public Classes getClasses() { 63 return classes; 64 } 65 66 public void setClasses(Classes classes) { 67 this.classes = classes; 68 } 69 70 @Override 71 public String toString() { 72 return "Student{" + 73 "sid=" + sid + 74 ", sname='" + sname + '\'' + 75 ", password='" + password + '\'' + 76 ", subject='" + subject + '\'' + 77 ", score=" + score + 78 ", classes=" + classes + 79 '}'; 80 } 81 }
5、在Common模块下创建服务接口ClassesService.java
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 package cn.kgc.service; 2 3 import cn.kgc.pojo.Classes; 4 5 import java.util.List; 6 7 /** 8 * Created by Administrator on 2019/3/12. 9 */ 10 public interface ClassesService { 11 List<Classes> optionData(); 12 }
6、在Common模块下创建服务接口StudentService.java
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 package cn.kgc.service; 2 3 import cn.kgc.pojo.Student; 4 import com.github.pagehelper.PageInfo; 5 6 import java.util.Map; 7 8 /** 9 * Created by Administrator on 2019/3/12. 10 */ 11 public interface StudentService { 12 PageInfo<Map<String,Object>> showPage(Integer pageno, Integer pagesize, Map<String,Object> map); 13 }
三、创建provider的模块: springboot的provider提供者子模块
四、创建Cosumer模块