SSM的中配置文件的详细配置和一个常见问题

1.一个最常见的错误就是,没有在导包的文件中生成.xml文件。解决方法:在pom.xml中写上如下代码配置即可


    
        src/main/java
        
            **/*.properties
            **/*.xml
        
        false
    

SSM的中配置文件的详细配置和一个常见问题_第1张图片

2.pom.xml的完整配置如下(前提是,spring和springmvc的jar已经提前整合到开发环境中去了)




    
        commonparent
        com.say.communicate
        1.0-SNAPSHOT
    
    4.0.0

    say
    war

    say Maven Webapp
    
    http://www.example.com

    
        UTF-8
        1.7
        1.7
    

    
        
            junit
            junit
            4.11
            test
        
        
        
            mysql
            mysql-connector-java
            5.1.35
        
        
        
            com.mchange
            c3p0
            0.9.5.2
        
        
            jstl
            jstl
            1.2
        
        
            taglibs
            standard
            1.1.2
        
        
            log4j
            log4j
            1.2.12
        
        
            org.slf4j
            slf4j-api
            1.7.12
        
        
            org.slf4j
            slf4j-log4j12
            1.7.12
        
        
        
            org.mybatis
            mybatis-spring
            1.3.1
        
        
        
            org.mybatis
            mybatis
            3.4.6
        

        
            com.google.code.gson
            gson
            1.7.2
        

        
            org.springframework
            org.springframework.beans
            3.1.0.RELEASE
        


    

    
        say
            
                
                    src/main/java
                    
                        **/*.properties
                        **/*.xml
                    
                    false
                
            
        
            
                
                    maven-clean-plugin
                    3.1.0
                
                
                
                    maven-resources-plugin
                    3.0.2
                    
                        
                            copy-xmls
                            process-sources
                            
                                copy-resources
                            
                            
                                ${basedir}/target/classes
                                
                                    
                                        ${basedir}/src/main/java
                                        
                                            **/*.xml
                                        
                                    
                                
                            
                        
                    
                
                
                    maven-compiler-plugin
                    3.8.0
                
                
                    maven-surefire-plugin
                    2.22.1
                
                
                    maven-war-plugin
                    3.2.2
                
                
                    maven-install-plugin
                    2.5.2
                
                
                    maven-deploy-plugin
                    2.8.2
                
            
        
    

applicationContext.xml的配置




   
   
   
   
   
   
      
      
      
      
   
   
   
      
   
    
    
        
        
        
        
        
        
        
    
    
    
        
        
        
    

    
    

jdbc.properties的文件配置

jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/saywords?characterEncoding=utf-8
jdbc.username=root
jdbc.password=123456

log4j.properties的文件配置

# Global logging configuration
log4j.rootLogger=stdout
# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

springmvc.xml的配置



    
    
    
       
    

    
    

    

    
        
        
    
web.xml的配置



  Archetype Created Web Application
    
        log4jConfigLocation
        classpath:log4j.properties
    

    
        log4jRefreshInterval
        60000
    
    
        contextConfigLocation
        classpath:applicationContext.xml
    
    
        org.springframework.web.context.ContextLoaderListener
    
    
        dispatcher
        org.springframework.web.servlet.DispatcherServlet
        
            contextConfigLocation
            classpath:springmvc.xml
        
        1
    
    
        dispatcher
        *.action
    

 

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