栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

ssm框架的整合

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

ssm框架的整合

ssm框架整合
  • 前言
  • 一、使用步骤
    • 1.创建一个maven项目,并且把项目添加为web项目
    • 2.加入pom依赖
    • 3、配置web.xml
    • 4、配置spring.xml文件
    • 5、配置springmvc.xml文件
    • 6、mybatis的配置
  • 总结


前言 虽然现在都在使用springboot开发,springboot也是基于ssm之后做的简化整合时的配置都是大同小异的,为了方便以后万一用到ssm框架,做个笔记方便以后搭建

提示:以下是本篇文章正文内容,下面案例可供参考

一、使用步骤 1.创建一个maven项目,并且把项目添加为web项目 2.加入pom依赖

        
        
            junit
            junit
            4.12
            test
        
        
        
            org.springframework
            spring-context
            5.2.3.RELEASE
        
        
        
            cglib
            cglib
            3.3.0
        
        
        
            org.aspectj
            aspectjweaver
            1.9.5
        
        
        
            aopalliance
            aopalliance
            1.0
        
        
        
            org.springframework
            spring-aspects
            5.2.3.RELEASE
        
        
        
            com.alibaba
            druid
            1.1.21
        
        
        
            mysql
            mysql-connector-java
            5.1.48
        
        
        
            org.springframework
            spring-web
            5.2.3.RELEASE
        
        
        
            org.springframework
            spring-webmvc
            5.2.3.RELEASE
        
        
            javax.servlet
            servlet-api
            2.5
            provided
        
        

        
            javax.servlet
            jsp-api
            2.0
            provided
        
        
        
            com.fasterxml.jackson.core
            jackson-core
            2.10.3
        
        
        
            com.fasterxml.jackson.core
            jackson-databind
            2.10.3
        
        
        
            com.fasterxml.jackson.core
            jackson-annotations
            2.10.3
        
        
        
            commons-io
            commons-io
            2.6
        
        
        
            commons-fileupload
            commons-fileupload
            1.4
        
        
        
            javax.servlet
            jstl
            1.2
        
        
        
            org.mybatis
            mybatis
            3.5.4
        
        
        
            mysql
            mysql-connector-java
            8.0.19
        
        
        
            junit
            junit
            4.13
            test
        
        
        
            log4j
            log4j
            1.2.17
        
        
            org.mybatis.caches
            mybatis-ehcache
            1.2.0
        
        
        
            org.slf4j
            slf4j-api
            2.0.0-alpha1
        
        
        
            org.slf4j
            slf4j-log4j12
            2.0.0-alpha1
            test
        
        
        
            org.mybatis
            mybatis-spring
            2.0.4
        

    
3、配置web.xml
    
    
        org.springframework.web.context.ContextLoaderListener
    
    
        contextConfigLocation
        classpath:spring.xml
    
    
    
        springmvc
        org.springframework.web.servlet.DispatcherServlet
        
            contextConfigLocation
            classpath:springmvc.xml
        
        1
    
    
        springmvc
        /
    
    
    
        CharacterEncoding
        org.springframework.web.filter.CharacterEncodingFilter
        
            encoding
            utf-8
        
        
            forceEncoding
            true
        
    
    
        CharacterEncoding
        /*
    
   
    
        rest
        org.springframework.web.filter.HiddenHttpMethodFilter
    
    
        rest
        /*
    
4、配置spring.xml文件

spring配置时顺便吧mybatis也配置了,就不需要配置mybatis了

    
    
        
    
    
    
    
    
        
        
        
        
    

    
    
        
    
    
    

    
    
        
        
    
    
    
    
    
    
5、配置springmvc.xml文件
    
    
        
    
    
    
    
    
    
    
        
        
    
6、mybatis的配置

因为配置spring.xml中已经集成了mybatis的操作,所以我们如果需要懒加载之类的配置时在另行配置

总结

ssm基本配置,需要的时候直接复制一下更改一下配置细节即可

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/349417.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号