使用idea创建第一个ssm项目

创建新工程

使用idea创建第一个ssm项目_第1张图片

选择maven,勾选create from archetype,选择webapp,下一步

使用idea创建第一个ssm项目_第2张图片

填写groupId,artifactId,下一步,一直下一步,最后finish

使用idea创建第一个ssm项目_第3张图片

等到完成之后,可以看到下列项目结构

使用idea创建第一个ssm项目_第4张图片

接下来看一下我们最后应该完成的包结构,如下图

使用idea创建第一个ssm项目_第5张图片

根据以上增加包,以及文件

其中pom.xml为



  4.0.0

  com.lyb.ssm
  linyongbin
  1.0-SNAPSHOT
  war

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

  
    1.7
    1.7
    UTF-8
    UTF-8
    
    4.3.5.RELEASE
    
    3.4.1
  

  
    
    
      javax
      javaee-api
      7.0
    

    
    
      junit
      junit
      4.12
    

    
    
      ch.qos.logback
      logback-classic
      1.2.2
    

    
    
      com.fasterxml.jackson.core
      jackson-databind
      2.8.7
    


    
    
      mysql
      mysql-connector-java
      5.1.41
      runtime
    

    
    
      com.mchange
      c3p0
      0.9.5.2
    

    
    
      org.mybatis
      mybatis
      ${mybatis.version}
    

    
    
      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}
    
  

  
    linyongbin
    
      
        
          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.2
        
          ${basedir}/src/main/resources/generator/generatorConfig.xml
          true
          true
        
      

      
    
  

jdbc.properties为

jdbc.driver=com.mysql.jdbc.Driver
#数据库地址
jdbc.url=jdbc:mysql://xxxxxxxxx:3306/ChatRobot?useUnicode=true&characterEncoding=utf8
#用户名
jdbc.username=xxxx
#密码
jdbc.password=xxxxx
#最大连接数
c3p0.maxPoolSize=30
#最小连接数
c3p0.minPoolSize=10
#关闭连接后不自动commit
c3p0.autoCommitOnClose=false
#获取连接超时时间
c3p0.checkoutTimeout=10000
#当获取连接失败重试次数
c3p0.acquireRetryAttempts=2

spring-mybatis.xml


       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/tx
       http://www.springframework.org/schema/tx/spring-tx.xsd">

   
   

   
   

   
   
       
       
       
       
       
       
       
       
       
   

   
   
       
       
       
       
       
       
   

   
   
       
       
       
       
   

   
   
       
       
   

   
   

spring-mvc.xml


       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/mvc
       http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">

   
   

   
   

   
   

   
   
       
       
       
   

web.xml


         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">

    ChatRobot
    ChatRobot_Alpha_0.0.1

   
   
        encodingFilter
        org.springframework.web.filter.CharacterEncodingFilter
       
            encoding
            UTF-8
       

   

   
        encodingFilter
        /*
   

   
   
        SpringMVC
        org.springframework.web.servlet.DispatcherServlet
       
       
            contextConfigLocation
            classpath:spring-*.xml
       

        1
        true
   

   
        SpringMVC
       
        /
   

   
        index.html
   

你可能感兴趣的:(使用idea创建第一个ssm项目)