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子项目


 

 

 

 

 

3    Coding

posted on 2024-04-28 08:14  菜鸟乙  阅读(6)  评论(0编辑  收藏  举报