前言

大型Java项目都需要根据项目功能进行工程的细化;

Maven项目多模块是用项目层次的划分,替代简单的包层次的划分,遵循了高内聚,低耦合的设计模式;

工程细化的思想:分Java文件-------》分包-------》分模块-------》分工程(微服务);

我们可以借助Maven实现Java项目的分模块化开发:

  • 父工程和子模块之间的依赖会继承
  • 管理模块之间的依赖关系

 

一、Maven基础(回顾)

回顾之前学过的maven基础知识;

1.maven作用

  • 依赖管理:pom.xml添加依赖
  • 一键构建:点击按钮完成项目构建

2.maven常用命令

clean:    删除target目录(清理上一次构建过程产生的临时文件)

compile:编译src/mian/java目录下的java文件为.class文件

test:        编译src/mian/test目录下的java文件为.class文件并运行

packaage:打包编译src/mian/包含java、resources、webapp目录

install:   包部署到本地仓库

deploy:包部署到私服

3.maven生命周期

每一个生命周期就是一系列命令的集合

清理:clean

默认:compile--->test--->pakage--->install-deploy

站点:site

4.maven仓库种类

本地仓库:开发者电脑

私服:公司内网服务器

远程/中央仓库:公网服务器

5.maven主要标签

groupId : com.itheima 公司域名倒写
artifactId : spring 项目名称
version : 1.0-SNAPSHOT SNAPSHOT(快照) 测试版本 、 RELEASE(发行) 稳定版本
packing : 打包方式有 jar包 java、  war: web、  pom: 父工程

 

二、分模块开发(理论)

当1个大型Java项目中,我们可以把1个项目拆分成多个子模块,借助maven给每个当前项目中各个子模块,产生1个唯一的GAV坐标;(拆分)

把当前项目/模块安装到本地仓库中;

多个子模块之间就可以通过Maven的dependency标签引入当前模块依赖的其他模块,以完成模块之间的相互调用 ;                                             (聚合)

1.模块的拆分和聚合思想

1.1.拆分:将原来的一个项目拆分成各个子模块, 每个子模块都有自己的GAV坐标;

1.2.聚合:通过GAV坐标的形式,将各个模块组装在一起,完成一个项目的功能;

2.项目和子模块的关系

项目和子模块属于继承关系,在父工程中声明的依赖,子模块都可以使用;

2.子模块之间的关系

子模块和子模块之间默认情况下没有任何关系,但是可以通过GAV坐标建立依赖关系;

3.父子工厂搭建

把1个SSM项目拆分成 ssm-web----------->ssm-service-----------> ssm-dao这3个子模块,建立依赖关系,完成模块之间功能调用;

3.1.创建父工程

删除父工程的src目录;

3.2.创建持久层模块

创建持久层模块-普通Java工程

 

3.3.创建业务层模块

创建业务层模块-普通Java工程

3.4.创建表示层模块

创建表示层模块-web工程

由于表示层需要和web页面交互,需要把表示层模块转换成1个web工程;

 

3.5.建立模块之间的依赖

编译阶段2个模块之间建立依赖:可以通过源码建立依赖; 

运行阶段2个模块之间建立依赖:必须把依赖的模块部署(package)到本地仓库中,才能被依赖;

两个模块是否建立依赖成功,可以从maven的Dependencies中查看

3.5.1.ssm-service和ssm-dao模建立依赖

    <dependency>
        <groupId>com.zhanggen</groupId>
        <artifactId>ssm-dao</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
</dependencies>

3.5.2.ssm-web    和ssm-service模块建立依赖

    <dependencies>
        <!--引入ssm-service模块的依赖-->
        <dependency>
            <groupId>com.zhanggen</groupId>
            <artifactId>ssm-service</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
    </dependencies>

 

3.6.依赖关系梳理

在上面的工程中存在两套关系;

3.6.1.父子工程之间继承关系

当父工程中的引入了Junit依赖之后,父工程中所有子模块也会继承Junit依赖,都可以使用的Junit功能;

3.6.2.依赖关系传递

当ssm-web模块-------依赖-------->ssm-service模块-------依赖-------->ssm-dao模块时;

此时ssm-web模块也可以调用ssm-dao模块中的功能;

ssm-web模块的配置文件也会读取ssm-dao模块所需要的依赖;

 

package com.heima.behavior;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

import javax.sql.DataSource;
//排除model模块传递的DataSource数据库依赖
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
@EnableDiscoveryClient
public class BehaviorApplication {
    public static void main(String[] args) {
        SpringApplication.run(BehaviorApplication.class, args);
    }
}

 ---------------------------

 

 

3.7.依赖冲突

在依赖的传递过程中,很容易出现同一jar包的版本冲突问题,这个就称为依赖冲突;

例如以下依赖2条关系代

  • A------依赖----->B,    B------依赖----->D1.0
  • A------还依赖----->C,C------依赖----->D2.0

此时A依赖D1.0版本呢?还是依赖D2.0版本呢?

3.8.依赖冲突解决

我们可以使用以下方法选择出1个唯一的版本的依赖;

3.8.1.第一声明优先原则

在pom文件定义依赖,先声明的依赖为准。

3.8.2.路径近者优先原则

从依赖程序开始算起,到被依赖的程序,以路径短的为准。

3.8.3.依赖排除

依赖排除就是在依赖引入的过程中,通过exclusions标签排掉指定的跟随依赖;

3.8.4.版本锁定

面对众多的依赖,有一种方法不用考虑依赖路径、声明优先等因素;

可以在pom文件中使用dependencyManagement标签进行版本锁定;

版本锁定后,系统会以锁定的版本的为准添加到工程中,此方法在企业开发中常用;

 <!--版本锁定-->
    <dependencyManagement>
        <dependencies>
            <!-- 给Feign、Gateway、Eureka等提供版本支持 -->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Hoxton.SR10</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- 给Nacos、Sentinel、Dubbo等提供版本支持 -->
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                <version>2.2.6.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

3.8.5.dependencies和dependencyManagement标签的区别

  • dependencyManagement标签:在父项目中进行依赖版本的统一,不会真正引入依赖,避免出现依赖冲突;
  • dependencies标签:                   在子项目中进行依赖包的真正引入,但是引入依赖包的版本会受到父项目的限制

3.8.6.提取版本信息(优化版本依赖)

为了保证版本信息可以重用,我们可以把版本信息提取到properties配置文件中;

 

3.9.模块循环依赖

当我们接手了老项项目,对这个老项目的子模块划分不是很了解;

经常在写代码的过程中,出现循环依赖,即A模块已经依赖了B模块,但B模块还想依赖A模块;

Error:java: Annotation processing is not supported for module cycles. 
Please ensure that all modules from cycle [wzhfunding-admin-webUI01,wzhfunding-admin-componet] are excluded from annotation processing

模块之间相互依赖就产生了循环依赖;

 

1. IDEA发现循环依赖

我们可以借助IDEA开发工具,发现循环依赖;

 

 

2.模块循环解决方法

如果A模块和B模块相互(循环)依赖,

A<-->B

可以抽取出相互依赖的类,封装到C模块;

A-->C

B-->C

 

三、SSM环境搭建(实践)

以上搭建了出了1个父子工程,父工程中包含ssm-web、ssm-service、ssm-dao这3个子模块;

以下将基于该父子工程,完善子模块中的功能,搭建出一套SSM环境;

准备数据环境(使用现在的spring库student表)

-- 创建学生表
CREATE TABLE student(
  number VARCHAR(10) UNIQUE,   -- 学号
  NAME VARCHAR(10),            -- 姓名
  birthday DATE,               -- 生日
  address VARCHAR(200)         -- 地址
);
INSERT INTO student VALUES ('hm001','张弢','1995-05-05','北京市昌平区');
INSERT INTO student VALUES ('hm002','少林圣神','1996-06-06','北京市海淀区');
INSERT INTO student VALUES ('hm003','易云','1997-07-07','北京市朝阳区');
INSERT INTO student VALUES ('hm004','易天行','1998-08-08','北京市丰台区');
INSERT INTO student VALUES ('hm005','易继风','1999-09-09','北京市顺义区');
INSERT INTO student VALUES ('hm006','飞龙将军','2000-01-01','北京市西城区');
INSERT INTO student VALUES ('hm007','逍遥王','2001-02-02','北京市延庆区');
INSERT INTO student VALUES ('hm008','张君宝','2002-03-03','北京市东城区');
INSERT INTO student VALUES ('hm009','张启樵','2003-04-04','北京市东城区');

student.sql
student.sql

准备项目环境(就使用现在的环境, 但是要把坐标加入到父工程中的pom文件)

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.zhanggen</groupId>
    <artifactId>ssm-project</artifactId>
    <!--打包方式声明为pom:代表当前这是父工程的pom文件-->
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>
    <!--声明当前父工程管理的子模块有哪些-->
    <modules>
        <module>ssm-dao</module>
        <module>ssm-service</module>
        <module>ssm-web</module>
    </modules>

    <dependencies>
        <!--mybatis相关的坐标-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.6</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.5.0</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>1.1.15</version>
        </dependency>


        <!--spring相关的坐标-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>5.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>5.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.8.7</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>5.1.6.RELEASE</version>
        </dependency>



        <!--springmvc相关的坐标-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>5.1.6.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.9.8</version>
        </dependency>


        <!--mybatis-spring-->
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis-spring</artifactId>
            <version>2.0.1</version>
        </dependency>


        <!--辅助坐标-->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.6</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.12</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
    </dependencies>

</project>
pom.xml

1.修改ssm-dao模块

1.1.创建实体类

package com.zhanggen.domain;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Student {
    private String number;
    private String name;
    private Date birthday;
    private String address;
}
Student.java

1.2.创建mapper层接口

package com.zhanggen.mapper;

import com.zhanggen.domain.Student;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface StudentMapper {
    //查询所有
    @Select("select * from student")
    List<Student> findAll();
}
StudentMapper.interface

1.3.添加配置文件

jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://192.168.56.18:3306/dbForJava?characterEncoding=utf8
jdbc.username=zhanggen
jdbc.password=123.com
jdbc.properties

----------------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                http://www.springframework.org/schema/beans/spring-beans.xsd
                http://www.springframework.org/schema/context
                http://www.springframework.org/schema/context/spring-context.xsd
                http://www.springframework.org/schema/aop
                http://www.springframework.org/schema/aop/spring-aop.xsd
                http://www.springframework.org/schema/tx
                http://www.springframework.org/schema/tx/spring-tx.xsd">
    <!--配置:引入properties配置文件-->
    <context:property-placeholder location="classpath:jdbc.properties"/>
    <!--配置:DruidDataSource数据源-->
    <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
        <property name="driverClassName" value="${jdbc.driver}"></property>
        <property name="url" value="${jdbc.url}"></property>
        <property name="username" value="${jdbc.username}"></property>
        <property name="password" value="${jdbc.password}"></property>
    </bean>
    <!--配置:SqlSessionFactoryBean工厂-->
    <bean id="sessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource"></property>
    </bean>
    <!--配置:Mybatis扫描的mapper接口-->
    <bean id="configurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="basePackage" value="com.zhanggen.mapper"></property>
    </bean>

</beans>
applicationContext-dao.xml

1.4.测试

package com.zhanaggen;

import com.zhanggen.domain.Student;
import com.zhanggen.mapper.StudentMapper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext-dao.xml")
public class StudentMapperTest {
    @Autowired
    private StudentMapper studentMapper;

    @Test
    public void testFindAll() {
        List<Student> studentList = studentMapper.findAll();
        for (Student student : studentList) {
            System.out.println(student);
        }

    }
}
StudentMapperTest.java

 

2.修改ssm-service模块

2.1.创建service层接口

package com.zhanggen.service;

import com.zhanggen.domain.Student;

import java.util.List;

public interface StudentService {
    //查询所有
    List<Student> findAll();
}
StudentService.interface

2.2.创建service实现类

package com.zhanggen.service.impl;

import com.zhanggen.domain.Student;
import com.zhanggen.mapper.StudentMapper;
import com.zhanggen.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentMapper studentMapper;

    //查询所有
    public List<Student> findAll() {
        return studentMapper.findAll();
    }
}
StudentServiceImpl.java

2.3.添加配置文件

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                http://www.springframework.org/schema/beans/spring-beans.xsd
                http://www.springframework.org/schema/context
                http://www.springframework.org/schema/context/spring-context.xsd
                http://www.springframework.org/schema/aop
                http://www.springframework.org/schema/aop/spring-aop.xsd
                http://www.springframework.org/schema/tx
                http://www.springframework.org/schema/tx/spring-tx.xsd">

    <!--注解扫描-->
    <context:component-scan base-package="com.zhanggen">
        <context:exclude-filter type="annotation"
                                expression="org.springframework.web.bind.annotation.RestController"/>
    </context:component-scan>

    <!--&lt;!&ndash;导入applicationContext-dao.xm配置文件&ndash;&gt;-->
    <!--<import resource="applicationContext-dao.xml"/>-->

    <!--事务管理器-->
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource"/>
    </bean>

    <!--事务注解驱动-->
    <tx:annotation-driven transaction-manager="transactionManager"/>
</beans>
applicationContext-service.xml

2.4.测试

分模块开发的项目,spring容器启动之后,如何加载各个子模块下的配置文件?

监听器:监听到tomcat启动

classpath*:搜索的时候既要搜索当前项目,又要搜索当前项目依赖的jar包中的类路径

@ContextConfiguration("classpath*:applicationContext-*.xml")

package com.zhanggen;

import com.zhanggen.domain.Student;
import com.zhanggen.service.StudentService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
//@ContextConfiguration({"classpath:applicationContext-service.xml", "classpath:applicationContext-dao.xml"})
//classpath*:搜索的时候既要搜索当前项目,又要搜索当前项目依赖的jar包中的类路径
@ContextConfiguration("classpath*:applicationContext-*.xml")
public class StudentServiceTest {
    @Autowired
    private StudentService studentService;

    @Test
    public void testFindAll() {
        List<Student> studentList = studentService.findAll();
        for (Student student : studentList) {
            System.out.println(student);
        }

    }
}
StudentServiceTest.java

 

3.修改ssm-web模块

3.1.创建controller层处理器

package com.zhanggen.controller;

import com.zhanggen.domain.Student;
import com.zhanggen.service.StudentService;
import com.zhanggen.vo.ResultInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class StudentController {

    @Autowired
    private StudentService studentService;

    //查询所有
    @GetMapping("/student")
    public ResultInfo findAll() {
        List<Student> studentList = studentService.findAll();
        return ResultInfo.success(studentList);
    }
}
StudentController.java

3.2.创建结果信息类

统一后端响应信息格式;

package com.zhanggen.controller;

import com.zhanggen.domain.Student;
import com.zhanggen.service.StudentService;
import com.zhanggen.vo.ResultInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class StudentController {

    @Autowired
    private StudentService studentService;

    //查询所有
    @GetMapping("/student")
    public ResultInfo findAll() {
        List<Student> studentList = studentService.findAll();
        return ResultInfo.success(studentList);
    }
}
ResultInfo.java

3.3.添加springMVC配置

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        https://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/mvc
        https://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://www.springframework.org/schema/aop
        https://www.springframework.org/schema/aop/spring-aop.xsd
        http://www.springframework.org/schema/context
        https://www.springframework.org/schema/context/spring-context.xsd">

    <!--注解扫描-->
    <context:component-scan base-package="com.zhanggen.controller"/>

    <!--注解驱动-->
    <mvc:annotation-driven/>

    <!--释放静态资源-->
    <mvc:resources mapping="/index.html" location="/"/>
    <mvc:resources mapping="/css/*" location="/css/"/>
    <mvc:resources mapping="/fonts/*" location="/fonts/"/>
    <mvc:resources mapping="/img/*" location="/img/"/>
    <mvc:resources mapping="/js/*" location="/js/"/>
    <!--释放静态文件-->
    <!--文件上传解析器-->
    <!--类型转换-->
</beans>
spring-mvc.xml

3.4.配置web.xml

spring监听器:当Tomcat启动时自动装配当前项目下所有子模块下的配置文件,启动spring

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         version="2.5">
    <!--1.spring监听器:当Tomcat启动时自动装配当前项目下所有子模块下的配置文件,启动spring-->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <!--注意加载当前项目里所有模块下的配置文件-->
        <param-value>classpath*:applicationContext-*.xml</param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <!--2.springMMV前端控制器-->
    <servlet>
        <servlet-name>dispatcherServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:spring-mvc.xml</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>dispatcherServlet</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
    <!--3.spring中文乱码过滤器:-->
    <filter>
        <filter-name>characterEncodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>utf-8</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>characterEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>
web.xml

 

4.项目部署和打包

分模块开发的项目,如何部署和打包?

4.1.项目部署

ssm项目需要部署时,只需要部署ssm项目下的ssm-web模块即可;

4.2.项目打包

当ssm项目打包(package)之后ssm-web模块根据pom中声明的依赖的模块ssm-service、ssm-dao, 以jar包的形式打进war里面;

 

 

参考

posted on 2022-05-25 16:18  Martin8866  阅读(195)  评论(0编辑  收藏  举报