ssm框架整合

spring,springmvc,mybatis
不用得到ssessino对象了,sessionFactory也不用要了,数据库的配置是在spring-bean里面的

pom.xml


    4.0.0
    com.qianfeng
    day65employeeMybatis
    war
    0.0.1-SNAPSHOT
    day65employeeMybatis Maven Webapp
    http://maven.apache.org

    
        4.12
        4.3.5.RELEASE
    

    
        
            junit
            junit
            3.8.1
            test
        

        
        
            javax.servlet
            javax.servlet-api
            3.1.0
            
            provided
        
        
        
            javax.servlet.jsp
            javax.servlet.jsp-api
            2.3.1
            provided
        
        
        
            javax.servlet
            jstl
            1.2
        
        
        
            log4j
            log4j
            1.2.17
        
        

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

        
        
            org.mybatis
            mybatis
            3.4.0
        
        
            org.mybatis
            mybatis-spring
            1.3.0
        

        
        
            com.fasterxml.jackson.core
            jackson-core
            2.8.2
        

        
        
            com.fasterxml.jackson.core
            jackson-databind
            2.8.2
        


        
        
            c3p0
            c3p0
            0.9.1.2
        
        
        
            mysql
            mysql-connector-java
            5.1.38
        

    

    
        day65employeeMybatis
        
        
            
            
                org.apache.tomcat.maven
                tomcat7-maven-plugin
                2.2
                
                    UTF-8
                    
                    /day65employeeMybatis
                
            
            
            
                org.apache.maven.plugins
                maven-compiler-plugin
                3.1
                
                    1.8
                    1.8
                    1.8
                    UTF-8
                
            
        
    

web.xml



  day65employeeMybatis
  
    index.html
    index.htm
    index.jsp
    default.html
    default.htm
    default.jsp
  

    
        characterEncoding
        org.springframework.web.filter.CharacterEncodingFilter
        
            encoding
            utf8
        
    
    
        characterEncoding
        /*
    

    
    
        HiddenHttpMethodFilter
        org.springframework.web.filter.HiddenHttpMethodFilter
    
    
        HiddenHttpMethodFilter
        /*
    

    
    
        DispatcherServlet
        org.springframework.web.servlet.DispatcherServlet
        
        
            contextConfigLocation
            
            classpath:spring-mvc.xml
        
        
        1
    
    
        DispatcherServlet
        
        /
    

    
    
    
        contextConfigLocation
        
        classpath:spring-bean.xml
        
    

    
        org.springframework.web.context.ContextLoaderListener
    
  
  

EmployeeMapper.xml这个就代替了dao层实现类,直接写上映射文件就ok





    
    
        
        
        
        
        
        
    
    
    
    
    
    
    
        insert into t_employee(name,age,phone,sex) values(#{name}, #{age}, #{phone}, #{sex})
    
    
    
        delete from t_employee where id=#{id}
    
    
    
        update t_employee set name=#{name},age=#{age},phone=#{phone},sex=#{sex} where id=#{id}
    
    
    
    
    
    

mybatis.xml





    
        
        
          
        
        
        
    

    
    
        
    

    
    
    

spring-bean.xml


 
  
    
   
        
        
   
  
   
    
        
        
        
        
        
        
        
    
    
    
   
        
        
        
        
        
        
        
   
   
   
   
        
        
   
   
    
    
        
        
    
   
    
   
        
            
            
            
            
            
            
            
            
        
   
   
   
   
        
        
   
        
        
   
   
   

spring-mvc.xml



       
       
       
       
            
            
       
       
       
       
       
       
       
       
       
        
        
            
            
            
            
        
        


        

还有log4j.properties

log4j.rootLogger=debug,stdout
### \u628A\u65E5\u5FD7\u4FE1\u606F\u8F93\u51FA\u5230\u63A7\u5236\u53F0 ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
#log4j.appender.stdout.Target=System.err
log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout
 
###\u663E\u793ASQL\u8BED\u53E5\u90E8\u5206
log4j.logger.com.ibatis=DEBUG
log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG
log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG
log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG
log4j.logger.java.sql.Connection=DEBUG
log4j.logger.java.sql.Statement=DEBUG
log4j.logger.java.sql.PreparedStatement=DEBUG

你可能感兴趣的:(ssm框架整合)