SSM搭建项目,从前端到后台(一)

首先搭建后台环境:

1. 先用maven下载依赖包

pom.xml文件如下:




    4.0.0

    HopeRun
    SSMMaven
    1.0-1
    war

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

    
        UTF-8
        1.8
        1.8

    

    
        
            junit
            junit
            4.11
            test
        

        
        
            log4j
            log4j
            1.2.17
        

        
        
            org.mybatis
            mybatis
            3.2.8
        

        
            org.mybatis
            mybatis-spring
            1.2.2
        

        
        
            org.springframework
            spring-core
            4.3.5.RELEASE
        
        
            org.springframework
            spring-web
            4.3.5.RELEASE
        
        
            org.springframework
            spring-aop
            4.3.5.RELEASE
        

        
            org.springframework
            spring-context
            4.3.5.RELEASE
        
        
            org.springframework
            spring-context-support
            4.3.5.RELEASE
        
        
            org.springframework
            spring-orm
            4.3.5.RELEASE
        
        
            org.springframework
            spring-webmvc
            4.3.5.RELEASE
        
        
            org.springframework
            spring-web
            4.3.5.RELEASE
        
        
            org.springframework
            spring-aspects
            4.3.5.RELEASE
        
        
            org.springframework
            spring-beans
            4.3.5.RELEASE
        
        
            org.springframework
            spring-expression
            4.3.5.RELEASE
        
        
            org.springframework
            spring-jdbc
            4.3.5.RELEASE
        
        
        
            dom4j
            dom4j
            1.6
        
        
        
            com.alibaba
            druid
            1.1.12
        
        
        
            com.alibaba
            fastjson
            1.2.54
        
        
        
            org.mybatis.generator
            mybatis-generator-core
            1.3.7
        
        
        
        
        
        
        
        
        
            mysql
            mysql-connector-java
            8.0.11
        
    

    
        SSMMaven
        
            
                
                    maven-clean-plugin
                    3.1.0
                
                
                
                    maven-resources-plugin
                    3.0.2
                
                
                    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
                

                
                
                    org.mybatis.generator
                    mybatis-generator-maven-plugin
                    1.3.7
                    
                        
                        src/main/java/generatorConfig.xml
                        true
                        true
                    
                    
                        
                            
                            
                                
                            
                        
                    
                    
                        
                            
                            
                            
                        
                    
                
            
        
    


这个地方因为是简单的表操作,所以使用逆向工程来生成mapper和mapper.xml
配置文件如下
generatorConfig.xml





    
    
    
    

        
            
            
        

        
        
        

        
        
            
        

        
        

        
        
        
            
            
        

        
        

这里面一定要主要有一个地方就是TargetRunTime这个地方一定要使用mybatis3,因为我改了一下名称,运行不出来,最后看了文档才生成成功。

2.spring 配置文件

applicationContext.xml




    
    
    
    
        
    
    
    
        
        
        
        

        

        
        
        
        

        
        

        
        
        

        
        

        
    
    
        
        
        
        
    

    
    
        
        
    
    
    
    
    

3.配置web.xml





  Archetype Created Web Application

  
    encoding
    org.springframework.web.filter.CharacterEncodingFilter
    
      encoding
      UTF-8
    
  
  
    encoding
    /*
  


  
    MavenSSM
    org.springframework.web.servlet.DispatcherServlet
    
      contextConfigLocation
      classpath*:config/springmvc/springmvc.xml
    
    
    
    
    1
  

  MavenSSM
  /


  
    contextConfigLocation
    classpath*:config/spring/applicationContext.xml
  
  
  
    org.springframework.web.context.ContextLoaderListener
  


4.springmvc.xml



    

    

    
    
    
    
    
    
        
        
        
        
    



5.mybatis.xml




    
    
        
    


我的项目在这里通过maven编译是不会报错的,明天我会把前端的配置也发上来。

你可能感兴趣的:(SSM搭建项目,从前端到后台(一))