SSM整合

简单SSM项目pom文件

    4.0.0
    wa
    wa
    war
    0.0.1-SNAPSHOT
    wa Maven Webapp
    http://maven.apache.org

    
        
        4.3.7.RELEASE
    

    

        
        
            junit
            junit
            4.12
            test
        

        
        
            javax.servlet
            javax.servlet-api
            3.1.0
        
        
            javax.servlet.jsp
            javax.servlet.jsp-api
            2.3.1
        
        
            taglibs
            standard
            1.1.2
        
        
            jstl
            jstl
            1.2
        

        
        
            org.slf4j
            slf4j-api
            1.7.12
        

        
        
            ch.qos.logback
            logback-core
            1.1.2
        
        
            ch.qos.logback
            logback-classic
            1.1.2
        

        
        
            com.fasterxml.jackson.core
            jackson-databind
            2.7.4
        

        
        
            com.alibaba
            fastjson
            1.2.32
        

        
        
            mysql
            mysql-connector-java
            5.1.40
        

        
        
            com.alibaba
            druid
            1.0.5
        

        
        
            org.mybatis
            mybatis
            3.4.2
        
        
        
            org.mybatis
            mybatis-spring
            1.3.1
        

        
        
        
            org.springframework
            spring-core
            ${spring.version}
        
        
            org.springframework
            spring-beans
            ${spring.version}
        
        
            org.springframework
            spring-context
            ${spring.version}
        
        
        
            org.springframework
            spring-jdbc
            ${spring.version}
        
        
            org.springframework
            spring-tx
            ${spring.version}
        
        
        
            org.springframework
            spring-web
            ${spring.version}
        
        
            org.springframework
            spring-webmvc
            ${spring.version}
        
        
        
            org.springframework
            spring-test
            ${spring.version}
        

    

    
        wa
    

配置文件

SSM整合_第1张图片
配置文件结构
配置web.xml



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

    
        index.jsp
    

配置jdbc.properties
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://127.0.0.1:3306/database_name?useUnicode=true&characterEncoding=utf-8
jdbc.username=root
jdbc.password=
配置logback.xml



    
        
        
            %d{HH:mm:ss} [%-5level] %logger{48} %n-----> %msg%n
            
        
    

    
        
    
    

配置mybatis-config.xml文件





    
        
        
        
        
    

  
配置spring-dao.xml


        
    
    
    
    
    
        
        
        
        
    
    
    
    
        
        
        
        
    
    
    
    
        
        
    
        
        
配置spring-service.xml


        
    
    
    
    
    
        
    
    
    
    
        
        
配置spring-mvc.xml



    
    
        
    
          
        
       
    
    
    
    
        
        
             
        
        

以上为一个简单SSM项目的配置。

你可能感兴趣的:(SSM整合)