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

ssm简单整合

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

ssm简单整合

SSM整合

Spring MVC 负责实现 MVC 设计模式,MyBatis 负责数据持久层,Spring 负责管理 Spring MVC 和 MyBatis 相关对象的创建和依赖注入。

创建maven工程,添加依赖

无整合 pom.xml

    
    
        org.springframework
        spring-webmvc
        5.3.9
    
    
    
        org.springframework
        spring-aspects
        5.3.15
    
    
    
        org.springframework
        spring-jdbc
        5.3.15
    
    
    
        log4j
        log4j
        1.2.17
    
    
    
        mysql
        mysql-connector-java
        8.0.16
    

    
    
        com.alibaba
        druid
        1.2.6
    
    
    
        org.mybatis
        mybatis
        3.5.6
    
    
    
        org.mybatis
        mybatis-spring
        2.0.6
    
    
    
        org.thymeleaf
        thymeleaf
        3.0.11.RELEASE
    
    
    
        org.thymeleaf
        thymeleaf-spring5
        3.0.12.RELEASE
    


    
    
        javax.servlet
        javax.servlet-api
        3.1.0
        provided
    
    
    
        org.projectlombok
        lombok
        1.18.10
        provided
    
    
    
        junit
        junit
        4.13.1
        test
    




    
        
            src/main/java	
            
                
                ***.xml
            
            false
        
    

mybatis.xml



  
  

  
  
    
  

  
  
    
  

  
  
    
      
      
        
        
        
        
      
    
  

  
  
    
  


springConfig.xml



    
    
        
        
    


springmvc.xml



    
    
    
    
    
    
        
        
        
        
    
    
    
        
        
        
        
        
    
    
    
        
    
    
    
        
        
        
    

web.xml


    
    
        CharacterEncodingFilter
        org.springframework.web.filter.CharacterEncodingFilter
        
            encoding
            UTF-8
        
    
    
        CharacterEncodingFilter
        /*
    
    
    
        contextConfigLocation
        classpath:spring.xml
    
    
        org.springframework.web.context.ContextLoaderListener
    
    
    
        dispatcherServlet
        org.springframework.web.servlet.DispatcherServlet
        
            contextConfigLocation
            classpath:springmvc.xml
        
        1
    
    
        dispatcherServlet
        /
    

整合

主要是Spring整合Mybatis

mybatis.xml




   

springConfig.xml


    
    
    
    
        
        
    
    
    
        
        
        
        
    
    
    
        
        
        
        
    
    
    
        
    
    
    
        
    
    
    
        
            
            
            
            
            
            
            
            
            
            
            
        
    
    
    
        
        
    

springmvc.xml(没有变化)



    
    
    
    
    
    
        
        
        
        
    
    
    
        
        
        
        
        
    
    
    
        
    
    
    
        
        
        
    

web.xml(没有变化)


    
    
        CharacterEncodingFilter
        org.springframework.web.filter.CharacterEncodingFilter
        
            encoding
            UTF-8
        
    
    
        CharacterEncodingFilter
        /*
    
    
    
        contextConfigLocation
        classpath:springConfig.xml
    
    
        org.springframework.web.context.ContextLoaderListener
    
    
    
        dispatcherServlet
        org.springframework.web.servlet.DispatcherServlet
        
            contextConfigLocation
            classpath:springmvc.xml
        
        1
    
    
        dispatcherServlet
        /
    

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

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

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