(2019最新)使用Maven进行SSM整合(spring5.1.3+mybatis3.4.6+mysql8.0.11)

1.配置数据访问层applicationContext-dao.xml 

        1.1     头文件(xsd校验) 

 

            

        1.2     读取数据库连接配置文件

        1.3     配置druid数据源
         

  

                

                

                

                

  

        1.4    配置mybatis的(工厂SqlSessionFactoryBean
                  

 

                

                

                

                
 

        1.5    配置mapper包扫描
 



    

2.配置mybatis配置文件:sqlMapper.xml

        2.1    配置头文件               

 

            

        2.2    配置别名
             

    
                
    

3.配置业务层:applicationContext-service.xml

        3.1    头文件(xsd校验)        



        

        3.2    业务层注解扫描

  

 

4.配置事务管理:applicationContext-trans.xml

        4.1    头文件(xsd校验)



            

        4.2    配置事务管理器
     

 
        
 

        4.3    配置事务注解开发

 

5.配置springmvc.xml

       5.1    头文件(xsd校验)



       5.2    扫描@controller注解

 

       5.3    配置mvc注解驱动

 

       5.4    配置视图解析器
      

  

            

            

            

            

 

       5.5    对静态资源放行

        

        

        

6.配置web.xml

       6.1   头文件(xsd校验)  

 

        

       6.2   指定applicationContext-*.xml

        

            contextConfigLocation

            classpath:applicationContext-*.xml

        

       6.3   配置监听器加载指定配置文件

   
      
          org.springframework.web.context.ContextLoaderListener
      
   

       6.4   配置springmvc.xml文件的扫描



        springmvc

        org.springframework.web.servlet.DispatcherServlet

        

            contextConfigLocation

            classpath:springMVC.xml

        

        1

       6.5   配置请求拦截规则

  

            springmvc

            /

  

       6.6   配置过滤器防止post提交乱码



        encoding

        

            org.springframework.web.filter.CharacterEncodingFilter

        

        

            encoding

            utf-8

        





        encoding

        /*

7. 其它参考文件

       7.1   log4j.properties 

### Log4j\u914D\u7F6E ###
### \u4E0ESpring\u7ED3\u5408\u9700\u8981\u5728web.xml\u4E2D\u6307\u5B9A\u6B64\u6587\u4EF6\u4F4D\u7F6E\uFF0C\u5E76\u6DFB\u52A0\u76D1\u542C\u5668 ###
#\u5B9A\u4E49log4j\u7684\u8F93\u51FA\u7EA7\u522B\u548C\u8F93\u51FA\u76EE\u7684\u5730\uFF08\u76EE\u7684\u5730\u53EF\u4EE5\u81EA\u5B9A\u4E49\u540D\u79F0\uFF0C\u548C\u540E\u9762\u7684\u5BF9\u5E94\uFF09
#[ level ] , appenderName1 , appenderName2
log4j.rootLogger=DEBUG,console,file
 
#-----------------------------------#
#1 \u5B9A\u4E49\u65E5\u5FD7\u8F93\u51FA\u76EE\u7684\u5730\u4E3A\u63A7\u5236\u53F0
log4j.appender.console = org.apache.log4j.ConsoleAppender
log4j.appender.console.Target = System.out
log4j.appender.console.Threshold=DEBUG
####\u53EF\u4EE5\u7075\u6D3B\u5730\u6307\u5B9A\u65E5\u5FD7\u8F93\u51FA\u683C\u5F0F\uFF0C\u4E0B\u9762\u4E00\u884C\u662F\u6307\u5B9A\u5177\u4F53\u7684\u683C\u5F0F ###
#%c: \u8F93\u51FA\u65E5\u5FD7\u4FE1\u606F\u6240\u5C5E\u7684\u7C7B\u76EE\uFF0C\u901A\u5E38\u5C31\u662F\u6240\u5728\u7C7B\u7684\u5168\u540D
#%m: \u8F93\u51FA\u4EE3\u7801\u4E2D\u6307\u5B9A\u7684\u6D88\u606F,\u4EA7\u751F\u7684\u65E5\u5FD7\u5177\u4F53\u4FE1\u606F
#%n: \u8F93\u51FA\u4E00\u4E2A\u56DE\u8F66\u6362\u884C\u7B26\uFF0CWindows\u5E73\u53F0\u4E3A"/r/n"\uFF0CUnix\u5E73\u53F0\u4E3A"/n"\u8F93\u51FA\u65E5\u5FD7\u4FE1\u606F\u6362\u884C
log4j.appender.console.layout = org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=[%c]-%m%n
 
#-----------------------------------#
#2 \u6587\u4EF6\u5927\u5C0F\u5230\u8FBE\u6307\u5B9A\u5C3A\u5BF8\u7684\u65F6\u5019\u4EA7\u751F\u4E00\u4E2A\u65B0\u7684\u6587\u4EF6
log4j.appender.file = org.apache.log4j.RollingFileAppender
#\u65E5\u5FD7\u6587\u4EF6\u8F93\u51FA\u76EE\u5F55
log4j.appender.file.File=log/tibet.log
#\u5B9A\u4E49\u6587\u4EF6\u6700\u5927\u5927\u5C0F
log4j.appender.file.MaxFileSize=10mb
###\u8F93\u51FA\u65E5\u5FD7\u4FE1\u606F###
#\u6700\u4F4E\u7EA7\u522B
log4j.appender.file.Threshold=ERROR
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=[%p][%d{yy-MM-dd}][%c]%m%n
#4 mybatis \u663E\u793ASQL\u8BED\u53E5\u90E8\u5206
log4j.logger.org.mybatis=DEBUG
#log4j.logger.cn.tibet.cas.dao=DEBUG
#log4j.logger.org.mybatis.common.jdbc.SimpleDataSource=DEBUG#
#log4j.logger.org.mybatis.common.jdbc.ScriptRunner=DEBUG#
#log4j.logger.org.mybatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG#
#log4j.logger.java.sql.Connection=DEBUG
log4j.logger.java.sql=DEBUG
log4j.logger.java.sql.Statement=DEBUG
log4j.logger.java.sql.ResultSet=DEBUG
log4j.logger.java.sql.PreparedStatement=DEBUG

       7.2   jdbc.properties  (数据库驱动8.0版本以下,驱动名不加cj)

jdbc.driverClassName=com.mysql.cj.jdbc.Driver
jdbc.url=jdbc\:mysql\://localhost\:3306/crm?characterEncoding\=utf-8&useSSL\=false&serverTimezone\=GMT
jdbc.username=root
jdbc.password=123456

       7.3  pom.xml


    4.0.0
    com.wjp
    MavenSSM
    0.0.1-SNAPSHOT
    war
    
        3.0
        UTF-8
        UTF-8

        
        5.1.3.RELEASE

        
        3.4.6

        
        8.0.11

        
        1.7.18
        1.2.17

        
        1.0.9

    
    
        
            
                maven-compiler-plugin
                
                    1.8
                    1.8
                
            
        
    
    
        
        
            jstl
            jstl
            1.2
        

        
            javax
            javaee-api
            7.0
        

        
        
            junit
            junit
            4.11
            
            test
        

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

        
            org.springframework
            spring-test
            ${spring.version}
        

        
	    org.springframework
	    spring-aspects
	    ${spring.version}
	

        
        
            org.mybatis
            mybatis
            ${mybatis.version}
        

        
        
            org.mybatis
            mybatis-spring
            1.3.0
        

        
        
            mysql
            mysql-connector-java
            ${mysql-driver.version}
        
        
        
        
            com.alibaba
            fastjson
            1.1.41
        

        
        
            log4j
            log4j
            ${log4j.version}
        
        
            org.slf4j
            slf4j-api
            ${slf4j.version}
        
        
            org.slf4j
            slf4j-log4j12
            ${slf4j.version}
        

        
        
        
            org.codehaus.jackson
            jackson-mapper-asl
            1.9.13
        
        
        
            com.fasterxml.jackson.core
            jackson-core
            2.9.0
        
        
        
            com.fasterxml.jackson.core
            jackson-databind
            2.9.0
        

        
            commons-fileupload
            commons-fileupload
            1.3.1
        

        
            commons-io
            commons-io
            2.4
        

        
            commons-codec
            commons-codec
            1.9
        

        
        
            com.github.abel533
            ECharts
            3.0.0
        

        
            com.google.code.gson
            gson
            2.5
            compile
            true
        

        
            net.sf.jxls
            jxls-core
            1.0.5
        

        
            com.alibaba
            druid
            ${druid.version}
        

        
            org.hibernate
            hibernate-validator
            5.2.4.Final
        
    

 

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