SSM(Spring+Spring MVC+MyBatis)框架整合搭建详细步骤

简介: SSM(Spring+SpringMVC+MyBatis)框架集由Spring、MyBatis两个开源框架整合而成(SpringMVC是Spring中的部分内容)。常作为数据源较简单的web项目的框架。

第三章 SSM整合开发


  • SSM 编程,即 SpringMVC + Spring + MyBatis 整合,是当前最为流行的 JavaEE 开发技术架 构。其实 SSM 整合的实质,仅仅就是将 MyBatis整合入 Spring。因为 SpringMVC原本就是 Spring 的一部分,不用专门整合。
  • SSM 整合的实现方式可分为两种:基于 XML 配置方式,基于注解方式。


3.1 搭建SSM开发环境


3.1.1 添加pom.xml依赖


<!--servlet依赖-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<!-- jsp依赖 -->
<dependency> 
 <groupId>javax.servlet.jsp</groupId> 
 <artifactId>jsp-api</artifactId> 
 <version>2.2.1-b03</version> 
 <scope>provided</scope>
</dependency>
<dependency>
<!--springMVC依赖-->
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.2.5.RELEASE</version>
</dependency>
<!--SpringM处理事务的依赖-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>5.2.5.RELEASE</version>
</dependency>
<!--spring处理数据库连接的依赖-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.2.5.RELEASE</version>
</dependency>
<!--将数据转换为json格式的依赖-->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.0</version>
</dependency>
<!--spring整合mybatis的依赖-->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.3.1</version>
</dependency>
<!--mybatis的依赖-->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.1</version>
</dependency>
<!--数据库连接驱动-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.9</version>
</dependency>
<!--数据路连接池依赖-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.12</version>
</dependency>
复制代码


3.1.2 配置web.xml


(1)注册ContextLoaderListenter监听器

微信截图_20220610113648.png

  • 注册 ServletContext 监听器的实现类 ContextLoaderListener,用于创建 Spring 容器及将创 建好的 Spring 容器对象放入到 ServletContext 的作用域中。

(2) 注册字符集处理器

微信截图_20220610113657.png

  • 注册字符集过滤器,用于解决请求参数中携带中文时产生乱码问题。

(3)配置中央调度器

  • 配置中央调度器时需要注意,SpringMVC的配置文件名与其它 Spring配置文件名不相同。 这样做的目的是 Spring 容器创建管理 Spring 配置文件中的 bean, SpringMVC 容器中负责视 图层 bean 的初始。

微信截图_20220610113706.png

3.2 SSM整合注解开发


项目:ssm

需求:完成学生注册和信息浏览。


3.2.1 建表 Student

微信截图_20220610113756.png

3.2.2 新建 Web 工程


工程名称 ssm


3.2.3 maven 依赖


  • 添加项目搭建的时候哪些依赖即可。


3.2.4 定义包,组织程序的结构

微信截图_20220610113819.png微信截图_20220610113826.png

3.2.5 编写配置文件


(1) Jdbc 属性配置文件 jdbc.properties

jdbc.url=jdbc:mysql://localhost:3306/school
jdbc.username=root
jdbc.password=567cybtfboys
复制代码

(2) 配置web.xml

  • 配置中央调度器。将SpringMVC配置文件中的对象(Controller)全部加载到SpringMVC容器中。
  • 配置监听器。将Spring配置文件中的全部对象(Dao、Service)全部加载到Spring容器中。
  • 配置过滤器。解决post请求中的中文乱码问题。
  • web.xml可以加载出Spring.xml以及SpringMVC.xml文件。
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0">
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  <!--
    注册中央调度器,创建SpringMVC容器对象
    将SpringMVC配置文件中的所有被@Controller注解的类为Servlet对象
  -->
  <servlet>
    <servlet-name>myWeb</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>classpath:conf/SpringMVC.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>myWeb</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>
  <!--
    注册监听器,创建Spring容器对象,创建Spring.xml的配置文件中的所有对象。
    监听器加载spring主配置文件的路径是: /WEB-INF/spring.xml(Spring主配置文件)
    我们此时修改为自己的保存spring.xml的路径。
  -->
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:conf/Spring.xml</param-value>
  </context-param>
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  <!--注册声明过滤器,解决中文乱码问题-->
  <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>
  <!--强制请求对象(HttpServletRequest)使用encoding编码的值,也就是上边声明的这个 utf-8-->
  <init-param>
    <param-name>forceRequestEncoding</param-name>
    <param-value>true</param-value>
  </init-param>
  <!--设置应答对象(HttpServletResponse)使用encoding编码的值,也就是上边声明的这个 utf-8-->
  <init-param>
    <param-name>forceResponseEncoding</param-name>
    <param-value>true</param-value>
  </init-param>
  </filter>
  <filter-mapping>
  <filter-name>characterEncodingFilter</filter-name>
  <!--
    /* : 表示强制所有的请求先通过过滤器处理。
  -->
  <url-pattern>/*</url-pattern>
  </filter-mapping>
</web-app>
复制代码

(3) Spring配置文件 applicationContext.xml

  • Spring主配置文件组件扫描器扫描的是Dao、Service的对象。
  • 配置连接数据库的信息。
<?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"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">
    <!--Spring配置文件:声明service,dao,工具类等对象-->
    <!--声明数据库配置文件的位置-->
    <context:property-placeholder location="classpath:conf/jdbc.properties" />
    <!--声明数据源,连接数据库-->
    <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init"
          destroy-method="close">
        <!--
            使用value还是ref,得看name属性对应的setUrl()、setUsername()方法的形参中类型
            如果是简单数据类型(基本数据类型、包装类、String)就使用value
            如果是引用数据类型(Object object)、List、Map等需要使用ref
        -->
        <property name="url" value="${jdbc.url}?serviceTimezone=GMT%2B&amp;charsetEncoding=utf-8&amp;useUnicode=true"/>
        <property name="username" value="${jdbc.username}"/>
        <property name="password" value="${jdbc.password}"/>
    </bean>
     <!--使用SqlSessionFactoryBean创建SqlSessionFactory对象-->
    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource"/>
        <property name="configLocation" value="classpath:/conf/MyBatis.xml"/>
    </bean>
    <!--声明MyBatis的扫描器,创建Dao对象,也就是dao接口的实现类,使用的是JDK的动态代理创建-->
    <!--创建dao的动态代理对象-->
    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
        <!--这个也是路径信息,是包的全限定名称-->
        <property name="basePackage" value="com.yunbocheng.dao"/>
    </bean>
    <!--
        因为StudentDao没有对应的实现类,需要使用JDK动态代理来获取接口的实现类。
        而service接口存在实现类,直接是实现类上使用@Service声明这个创建的是一个Service对象。
    -->
    <!--声明service的注解的@Service所在包的位置,完成service的创建-->
    <context:component-scan base-package="com.yunbocheng.service"/>
    <!--事务配置:注解的配置,aspectJ的配置-->
</beans>
复制代码

(3) SpringMVC配置文件

  • SpringMVC主配置文件组件扫描器的是Controller(Servlet)对象。
  • 配置视图解析器,简化跳转页面时的路径。
  • 注册注解驱动,解决ajax请求转为json格式数据以及解决静态资源访问你的冲突(只有)
<?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:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd">
    <!--SpringMVC配置文件,声明controller和其他web相关的对象-->
    <!--声明组件扫描器,使用动态代理的方式创建Servlet的动态代理对象-->
    <context:component-scan base-package="com.yunbocheng.controller" />
    <!--配置视图解析器-->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <!--这里使用value属性,因为使用的是set注入的方式进行赋值-->
        <property name="prefix" value="/WEB-INF/jsp/" />
        <property name="suffix" value=".jsp" />
    </bean>
    <!--注解驱动,因为处理ajax请求(转换格式)以及静态资源(解决冲突)都需要用到注解驱动-->
    <mvc:annotation-driven/>
</beans>
复制代码

(4) 配置Mybatis.xml主配置文件

  • 配置输出日志信息设置。
  • 设置参与请求数据道的类型的别名。
  • 指定mapper映射文件的位置。
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    <!--设置输出日志-->
        <settings>
            <setting name="logImpl" value="STDOUT_LOGGING" />
        </settings>
    <!--设置别名,使用报名的方式,包中的类名就是别名-->
      <typeAliases>
         <package name="com.yunbocheng.entity"/>
     </typeAliases>
    <mappers>
        <!--
            使用package :指定dao接口包的位置,表示将包下面的sql映射文件找到
            name: Dao接口的包名
            使用package指定映射文件的要求:
                1. sql映射文件(StudentDao.xml)和接口名一致
                2. sql映射文件和Dao接口在同一目录
        -->
        <package name="com.yunbocheng.dao"/>
    </mappers>
</configuration>
复制代码


3.2.6 实体类


@Data
@AllArgsConstructor
@NoArgsConstructor
public class Student {
    // 属性名和数据库的列名一致,如果不一样的话需要使用resultMap进行修改
    private String num;
    private String province;
    private String city;
    private String name;
    private Integer age;
    private Double score;
    private String room;
}
复制代码


3.2.7 Dao接口和sql映射文件。


注意:

必须保证StudentDao接口与StudentDao.xml文件处于同一目录下。

必须保证接口的名称与配置文件的名称一致。

  • Dao接口的方法
public interface StudentDao {
    // 录入学生信息
    int insertStudent(Student student);
    // 查询全部的学生信息
    List<Student> selectStudent();
}
复制代码
  • sql映射文件
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yunbocheng.dao.StudentDao" >
    <resultMap id="student" type="com.yunbocheng.entity.Student">
        <id column="num" property="num"/>
        <result column="province" property="province"/>
        <result column="city" property="city"/>
        <result column="name" property="name"/>
        <result column="age" property="age"/>
        <result column="score" property="score"/>
        <result column="room" property="room"/>
    </resultMap>
    <select id="selectStudent" resultMap="student">
        /*在实际开发中,尽量不写*号,写列名*/
        select num,province,city,name,age,score,room from tab_student order by num;
    </select>
    <insert id="insertStudent" parameterType="Student">
        insert into tab_student(num,province,city,name,age,score,room) values (#{num},#{province},#{city},#{name},#{age},#{score},#{room})
    </insert>
</mapper>
复制代码


3.2.8 Service接口与实现类


  • Service接口
public interface StudentService {
    // 录入学生信息
    int addStudent(Student student);
    // 查询全部学生信息
    List<Student> findStudent();
}
复制代码
  • Service接口的实现类(实现StudentService接口)
/*声明Service对象*/
@Service
public class StudentServiceImpl implements StudentService {
    /*
        以前我们使用的是手动注入,在spring主配置文件中使用set手动注入。
        这里使用 引用类型的自动注入@Autowired,@Resource
        spring只能给引用类型的数据自动赋值,不可以给引用类型的数据赋值。
        @Resource默认使用的是byName,不成功的时候使用ByType
    */
    /*
        dao接口的首字母小写。这种使用的就是@resource的byName的方式
        @Resource(name = "studentDao")
    */
    /*
    * 这种使用的就是@Resource的byType方式
    * 使用自动注入的方式创建一个StudentDao对象
    * */
    @Resource
    private StudentDao studentDao;
    @Override
    public int addStudent(Student student) {
        return studentDao.insertStudent(student);
    }
    @Override
    public List<Student> findStudent() {
        return studentDao.selectStudent();
    }
}
复制代码


3.2.9 处理器定义(也就是Servlet对象)


@Controller
@RequestMapping(value = "/student")
public class StudentController {
    // 使用自动注入的方式创建一个Service对象
    @Resource
    private StudentService service;
    // 注册学生
    @RequestMapping(value = "/addStudent.do")
    /*在形参的部分接收前端传递过来的参数,此时使用student对象接收参数*/
    public ModelAndView addStudent(Student student){
        ModelAndView mv = new ModelAndView();
        String str = "学生 【" + student.getName() + "】 注册失败!";
        int nums = service.addStudent(student);
        System.out.println(nums);
        if (nums == 1){
            // 注册成功
            str = "学生 【" + student.getName() + "】 注册成功!";
        }
        // 添加数据
        mv.addObject("result",str);
        // 指定结果页面
        mv.setViewName("show");
        return mv;
    }
}
复制代码


3.2.10 定义一个视图-->首页文件-->index.jsp


  • 可以使用以下的方式指定当前项目的根路径。微信截图_20220610113933.png

网络异常,图片无法展示
|

  • 我们这里使用 application 域存储根路径。
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<% application.setAttribute("path",request.getContextPath());%>
<html>
<head>
    <title>SSM整合开发</title>
    <style>
        .myStudent{
            font-size: 30px;
            color: red;
        }
    </style>
</head>
<body>
    <div><img src="images/spring事务处理.png" alt="图片加载失败!"></div>
    <div align="center" class="myStudent"><a href="addStudent.jsp">注册学生信息</a></div>
    <div align="center" class="myStudent"><a href="selectStudent.jsp">查询学生信息</a></div>
</body>
</html>
复制代码


3.2.11 注册学生信息界面-->addStudent.jsp


<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<% application.setAttribute("path",request.getContextPath());%>
<html>
<head>
    <title>添加学生信息</title>
    <style>
        .myStudent{
            font-size: 30px;
            color: red;
        }
    </style>
</head>
<body>
<div><img src="images/spring事务处理.png" alt="图片加载失败!"></div>
<div align="center" class="myStudent">注册学生信息</div>
<form action="${path }/student/addStudent.do" method="post">
    <table align="center" border="2px">
        <tr>
            <th>
                学号:
            </th>
            <td>
                <%--需要保证请求参数名和Student类中的属性名一致--%>
                <input type="text" name="num" />
            </td>
        </tr>
        <tr>
            <th>
                省份:
            </th>
            <td>
                <%--需要保证请求参数名和Student类中的属性名一致--%>
                <input type="text" name="province" />
            </td>
        </tr>
        <tr>
            <th>
                城市:
            </th>
            <td>
                <%--需要保证请求参数名和Student类中的属性名一致--%>
                <input type="text" name="city" />
            </td>
        </tr>
        <tr>
            <th>
                姓名:
            </th>
            <td>
                <%--需要保证请求参数名和Student类中的属性名一致--%>
                <input type="text" name="name" />
            </td>
        </tr>
        <tr>
            <th>
                年龄:
            </th>
            <td>
                <%--需要保证请求参数名和Student类中的属性名一致--%>
                <input type="text" name="age" />
            </td>
        </tr>
        <tr>
            <th>
                分数:
            </th>
            <td>
                <%--需要保证请求参数名和Student类中的属性名一致--%>
                <input type="text" name="score" />
            </td>
        </tr>
        <tr>
            <th>
                教室:
            </th>
            <td>
                <%--需要保证请求参数名和Student类中的属性名一致--%>
                <input type="text" name="room" />
            </td>
        </tr>
        <tr>
            <td>
                <input type="submit" value="录入" />
            </td>
            <td>
                <input type="reset" value="重置" />
            </td>
        </tr>
    </table>
</form>
</body>
</html>
复制代码


3.2.12 显示处理结果界面-->show.jsp


<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>展示数据</title>
    <style>
        div{
            color: red;
            font-size: 30px;
        }
    </style>
</head>
<body>
    <div align="center" >${result}</div>
</body>
</html>



相关文章
|
XML Java 数据库连接
微服务——SpringBoot使用归纳——Spring Boot集成MyBatis——基于 xml 的整合
本教程介绍了基于XML的MyBatis整合方式。首先在`application.yml`中配置XML路径,如`classpath:mapper/*.xml`,然后创建`UserMapper.xml`文件定义SQL映射,包括`resultMap`和查询语句。通过设置`namespace`关联Mapper接口,实现如`getUserByName`的方法。Controller层调用Service完成测试,访问`/getUserByName/{name}`即可返回用户信息。为简化Mapper扫描,推荐在Spring Boot启动类用`@MapperScan`注解指定包路径避免逐个添加`@Mapper`
1383 0
|
SQL Java 数据库连接
区分iBatis与MyBatis:两个Java数据库框架的比较
总结起来:虽然从技术角度看,iBATIS已经停止更新但仍然可用;然而考虑到长期项目健康度及未来可能需求变化情况下MYBATISS无疑会是一个更佳选择因其具备良好生命周期管理机制同时也因为社区力量背书确保问题修复新特征添加速度快捷有效.
1093 12
|
Java 数据库连接 数据库
Spring boot 使用mybatis generator 自动生成代码插件
本文介绍了在Spring Boot项目中使用MyBatis Generator插件自动生成代码的详细步骤。首先创建一个新的Spring Boot项目,接着引入MyBatis Generator插件并配置`pom.xml`文件。然后删除默认的`application.properties`文件,创建`application.yml`进行相关配置,如设置Mapper路径和实体类包名。重点在于配置`generatorConfig.xml`文件,包括数据库驱动、连接信息、生成模型、映射文件及DAO的包名和位置。最后通过IDE配置运行插件生成代码,并在主类添加`@MapperScan`注解完成整合
1885 1
Spring boot 使用mybatis generator 自动生成代码插件
|
6天前
|
SQL XML Java
MyBatis 持久层框架技术详解与实践指南
本文档全面介绍 MyBatis 持久层框架的核心概念、架构设计和实际应用。作为 Java 生态中广泛使用的 ORM 框架,MyBatis 在 SQL 映射和数据库操作方面提供了灵活而强大的解决方案。本文将深入探讨其映射机制、动态 SQL、缓存策略、插件开发以及与 Spring 框架的集成方式,帮助开发者构建高效、可维护的数据访问层。
625 0
|
Java 数据库连接 API
Java 对象模型现代化实践 基于 Spring Boot 与 MyBatis Plus 的实现方案深度解析
本文介绍了基于Spring Boot与MyBatis-Plus的Java对象模型现代化实践方案。采用Spring Boot 3.1.2作为基础框架,结合MyBatis-Plus 3.5.3.1进行数据访问层实现,使用Lombok简化PO对象,MapStruct处理对象转换。文章详细讲解了数据库设计、PO对象实现、DAO层构建、业务逻辑封装以及DTO/VO转换等核心环节,提供了一个完整的现代化Java对象模型实现案例。通过分层设计和对象转换,实现了业务逻辑与数据访问的解耦,提高了代码的可维护性和扩展性。
684 1
|
SQL XML Java
MyBatis框架如何处理字符串相等的判断条件。
总的来说,MyBatis框架提供了灵活而强大的机制来处理SQL语句中的字符串相等判断条件。无论是简单的等值判断,还是复杂的条件逻辑,MyBatis都能通过其标签和属性来实现,使得动态SQL的编写既安全又高效。
950 0
|
SQL Java 数据库
解决Java Spring Boot应用中MyBatis-Plus查询问题的策略。
保持技能更新是侦探的重要素质。定期回顾最佳实践和新技术。比如,定期查看MyBatis-Plus的更新和社区的最佳做法,这样才能不断提升查询效率和性能。
1030 1
|
SQL Java 数据库连接
Spring、SpringMVC 与 MyBatis 核心知识点解析
我梳理的这些内容,涵盖了 Spring、SpringMVC 和 MyBatis 的核心知识点。 在 Spring 中,我了解到 IOC 是控制反转,把对象控制权交容器;DI 是依赖注入,有三种实现方式。Bean 有五种作用域,单例 bean 的线程安全问题及自动装配方式也清晰了。事务基于数据库和 AOP,有失效场景和七种传播行为。AOP 是面向切面编程,动态代理有 JDK 和 CGLIB 两种。 SpringMVC 的 11 步执行流程我烂熟于心,还有那些常用注解的用法。 MyBatis 里,#{} 和 ${} 的区别很关键,获取主键、处理字段与属性名不匹配的方法也掌握了。多表查询、动态
552 0
|
SQL Java 数据库连接
对Spring、SpringMVC、MyBatis框架的介绍与解释
Spring 框架提供了全面的基础设施支持,Spring MVC 专注于 Web 层的开发,而 MyBatis 则是一个高效的持久层框架。这三个框架结合使用,可以显著提升 Java 企业级应用的开发效率和质量。通过理解它们的核心特性和使用方法,开发者可以更好地构建和维护复杂的应用程序。
1157 29
|
前端开发 Java 数据库连接
Spring MVC 扩展和SSM框架整合
通过以上步骤,我们可以将Spring MVC扩展并整合到SSM框架中。这个过程包括配置Spring MVC和Spring的核心配置文件,创建控制器、服务层和MyBatis的Mapper接口及映射文件。在实际开发中,可以根据具体业务需求进行进一步的扩展和优化,以构建更加灵活和高效的企业级应用程序。
438 5

热门文章

最新文章