美文网首页
分模块开发和设计

分模块开发和设计

作者: 六年的承诺 | 来源:发表于2021-09-12 17:44 被阅读0次

    工程模块和模块划分
    将ssm这个项目分模块(前面三个模快的创建不需要用到模板,直接创建空的maven)


    15.png 10.png

    把上面的划分成下面的模块


    11.png

    首先ssm_dao分离

    点击如下:


    13.png

    创建一个新模块:


    14.png
    其他步骤就是创建maven项目
    下面是创建好的项目,只需要将domain的类导入,其他都不需要,没有配置
    12.png

    compile编译一下看是否成功

    ssm_dao的分离

    18.png

    创建一个新的模块
    然后把文件导入进去


    16.png

    pom文件

    <dependencies>
            <dependency>
                <groupId>com.itheima</groupId>
                <artifactId>ssm_pojo</artifactId>
                <version>1.0-SNAPSHOT</version>
            </dependency>
            <!--spring环境-->
            <!--spring环境-->
            <!--spring环境-->
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>5.1.9.RELEASE</version>
            </dependency>
    
    
            <!--mybatis环境-->
            <!--mybatis环境-->
            <!--mybatis环境-->
            <dependency>
                <groupId>org.mybatis</groupId>
                <artifactId>mybatis</artifactId>
                <version>3.5.3</version>
            </dependency>
            <!--mysql环境-->
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>5.1.47</version>
            </dependency>
            <!--spring整合jdbc-->
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-jdbc</artifactId>
                <version>5.1.9.RELEASE</version>
            </dependency>
            <!--spring整合mybatis-->
            <dependency>
                <groupId>org.mybatis</groupId>
                <artifactId>mybatis-spring</artifactId>
                <version>2.0.3</version>
            </dependency>
            <!--druid连接池-->
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>druid</artifactId>
                <version>1.1.16</version>
            </dependency>
            <!--分页插件坐标-->
            <dependency>
                <groupId>com.github.pagehelper</groupId>
                <artifactId>pagehelper</artifactId>
                <version>5.1.2</version>
            </dependency>
        </dependencies>
    
    

    ssm_service的分离

    19.png 17.png

    pom文件

     <dependencies>
            <!--spring环境-->
            <!--spring环境-->
            <!--spring环境-->
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>5.1.9.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>com.itheima</groupId>
                <artifactId>ssm_dao</artifactId>
                <version>1.0-SNAPSHOT</version>
            </dependency>
            <!--junit单元测试-->
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.12</version>
            </dependency>
            <!--spring整合junit-->
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-test</artifactId>
                <version>5.1.9.RELEASE</version>
            </dependency>
        </dependencies>
    

    ssm_controller的分离(这个模块的创建需要用到模板)

    21.png 20.png

    pom文件

     <dependencies>
        <dependency>
          <groupId>com.itheima</groupId>
          <artifactId>ssm_service</artifactId>
          <version>1.0-SNAPSHOT</version>
        </dependency>
        <!--springmvc环境-->
        <!--springmvc环境-->
        <!--springmvc环境-->
        <dependency>
          <groupId>org.springframework</groupId>
          <artifactId>spring-webmvc</artifactId>
          <version>5.1.9.RELEASE</version>
        </dependency>
        <!--jackson相关坐标3个-->
        <dependency>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-databind</artifactId>
          <version>2.9.0</version>
        </dependency>
        <dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>javax.servlet-api</artifactId>
          <version>3.1.0</version>
          <scope>provided</scope>
        </dependency>
      </dependencies>
    

    相关文章

      网友评论

          本文标题:分模块开发和设计

          本文链接:https://www.haomeiwen.com/subject/qfvawltx.html