spring+mybatis IntelliJ IDEA2018的配置,创建项目用maven

  • 创建maven项目

  • 项目结构(初次入门的话用这些即可)

  • spring+mybatis IntelliJ IDEA2018的配置,创建项目用maven_第1张图片
  • 配置文件

  1. pom.xml
    
    
    
      4.0.0
    
      com.ssm.web
      webSsm
      1.0-SNAPSHOT
      war
    
      webSsm Maven Webapp
      
      http://www.example.com
    
      
        UTF-8
        1.7
        1.7
        
        4.2.5.RELEASE
    
        
        3.2.8
    
        
        5.1.26
    
        
        1.7.18
        1.2.17
    
      
    
      
        
          junit
          junit
          4.11
          test
        
        
        
          jstl
          jstl
          1.2
        
    
        
          javax
          javaee-api
          7.0
        
        
        
          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.mybatis
          mybatis
          ${mybatis.version}
        
    
        
        
          org.mybatis
          mybatis-spring
          1.2.2
        
    
        
        
          mysql
          mysql-connector-java
          ${mysql-driver.version}
        
        
        
          commons-dbcp
          commons-dbcp
          1.2.2
        
        
          c3p0
          c3p0
          0.9.1.2
        
    
    
        
        
          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.8.0
        
        
        
          com.fasterxml.jackson.core
          jackson-databind
          2.8.0
        
    
        
          commons-fileupload
          commons-fileupload
          1.3.1
        
    
        
          commons-io
          commons-io
          2.4
        
    
        
          commons-codec
          commons-codec
          1.9
        
        
          org.junit.jupiter
          junit-jupiter-api
          RELEASE
        
    
        
        
          javax.servlet.jsp.jstl
          jstl-api
          1.2
        
        
          javax.servlet
          servlet-api
          2.5
          provided
        
    
        
          javax.servlet.jsp
          jsp-api
          2.1
          provided
        
      
    
      
        webSsm
        
          
            
              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
            
          
        
      
    
    
  2. mvc-dispatcher-servlet.xml
    
    
    
        
    
        
    
        
    
    
        
            
            
        
        
            
                
                    ioerror
                    sqlerror
                
            
        
        
        
            
            
                10485760
            
            
            
                UTF-8
            
        
    
    
  3. applicationContext.xml
    
    
    
       
        
        
        
    
    
    
  4. web.xml
    
    
    
      Archetype Created Web Application
    
    
    
      
        log4jConfigLocation
        classpath:log4j.properties
      
    
      
      
        encodingFilter
        org.springframework.web.filter.CharacterEncodingFilter
        
          encoding
          UTF-8
        
      
      
        encodingFilter
        /*
      
    
      
        org.springframework.web.context.ContextLoaderListener
      
    
      
        contextConfigLocation
        classpath:/applicationContext.xml
      
    
      
      
        ssm
        org.springframework.web.servlet.DispatcherServlet
        
          contextConfigLocation
          classpath:/mvc-dispatcher-servlet.xml
        
    
    
      
      
        ssm
        
        /
      
    
    
  • 测试是否成功

  1. 创建controller
package com.ssm.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller

public class HelloWorldController {
    @RequestMapping("/hello")
    public String hello(){
        return "hello";
    }

}

2.jsp文件

<%--
  Created by IntelliJ IDEA.
  User: peng
  Date: 2019/1/20
  Time: 20:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>


    Title


成功


spring+mybatis IntelliJ IDEA2018的配置,创建项目用maven_第2张图片

也是初学者,入的坑太多了,然后记录一下,不过会逐渐完善的。配置不仅仅是这些。接下来的时间学习的时候需要更加细心。

你可能感兴趣的:(spring+mybatis IntelliJ IDEA2018的配置,创建项目用maven)