0 課程地址
https://coding.imooc.com/lesson/201.html#mid=12743
1 重點關注
1.1 本節內容
如何將springMVC項目變更成Dubbo項目
2 課程內容
2.1 如何將springMVC項目變更成Dubbo項目
- 在dubbo項目下新建子項目item-service
- 新增的子項目item-service pom改造
a 將mvc項目item-service模塊的 pom文件中的以下部分(spring依賴)放入 新增的item-service子項目裏進行修改.spring依賴複製過來
<dependency> <groupId>com.imooc</groupId> <artifactId>imooc-single-mvc-mapper</artifactId> <version>0.0.1-SNAPSHOT</version> </dependency> <!-- Spring --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> </dependency>
b 將mvc項目mapper模塊的 pom文件以下部分放入新增的item-service子項目裏的pom文件(主要涉及do層及數據源操作)
<!-- Mybatis --> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis</artifactId> </dependency> <dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis-spring</artifactId> </dependency> <dependency> <groupId>com.github.miemiedev</groupId> <artifactId>mybatis-paginator</artifactId> </dependency> <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> </dependency> <!-- MySql --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <!-- 連接池 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> </dependency>
- 新增的子項目item-service 文件改造
a 將mvc項目mapper模塊的mapper文件夾以下文件(涉及sql和do)複製到新增的item-service子項目
並將和item無關的mapper刪掉(如:OrderMapper等),修改包名不報錯
b 將mvc項目item-service模塊的service實現類文件夾(涉及到實現),複製到新增的item-service子項目