栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

创建Maven项目

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

创建Maven项目

1.安装IDEA https://www.jb51.net/article/193606.htm?tdsourcetag=s_pcqq_aiomsg 2. 安装 Java

安装并设置JAVA_HOME环境变量:

3. 下载和解压Tomcat 1.IDEA配置Tomcat 2.IDEA配置MAVEN,更改settings 1. 创建Maven项目



改成1.8

pom.xml配置


    
      org.springframework
      spring-test
      4.3.23.RELEASE
    

    
      org.springframework
      spring-core
      4.3.23.RELEASE
    

    
      org.springframework
      spring-oxm
      4.3.23.RELEASE
    

    
      org.springframework
      spring-tx
      4.3.23.RELEASE
    

    
      org.springframework
      spring-jdbc
      4.3.23.RELEASE
    

    
      org.springframework
      spring-aop
      4.3.23.RELEASE
    

    
      org.springframework
      spring-context
      4.3.23.RELEASE
    

    
      org.springframework
      spring-context-support
      4.3.23.RELEASE
    

    
      org.springframework
      spring-expression
      4.3.23.RELEASE
    

    
      org.springframework
      spring-orm
      4.3.23.RELEASE
    

    
      org.springframework
      spring-web
      4.3.23.RELEASE
    

    
      org.springframework
      spring-webmvc
      4.3.23.RELEASE
    


    
      org.mybatis
      mybatis
      3.4.5
    
    
      org.mybatis
      mybatis-spring
      2.0.6
    

    
      com.oracle
      ojdbc6
      11.2.0.1.0
    

    
      commons-dbcp
      commons-dbcp
      1.4
    

    
      jstl
      jstl
      1.2
    

    
      javax.servlet
      javax.servlet-api
      3.1.0
    

    
      javax.servlet.jsp
      jsp-api
      2.1
    

    
      log4j
      log4j
      1.2.12
    

    
      org.slf4j
      slf4j-log4j12
      1.7.5
    

    
      com.alibaba
      druid
      1.1.8
    



在resources下新建spring-mvc.xml和applicationContext.xml

Java专属文件 jdbc.properties

配置jdbc.properties

driver=oracle.jdbc.driver.OracleDriver
url=jdbc:oracle:thin:@127.0.0.1:1521:ORCL
# 用户名
username=XX
# 密码
password=abc123
# 定义初始连接数
initialSize=0
# 定义最大连接数
maxActive=20
# 定义最大空闲
maxIdle=20
# 定义最小空闲
minIdle=1
# 定义最长等待时间
maxWait=60000

配置applicationContext.xml文件


        
    

    
        
        
        
        
    

    
        
        
        
    

    
        
        
    

在java文件夹下新建pojo包、dao包、controller包

在resources文件夹下新建mapper文件

配置spring-mvc.xml文件




    
    
    

    
      
          
          
          
      


配置web.xml文件



  Archetype Created Web Application


  
    org.springframework.web.context.ContextCleanupListener
  

  
    contextConfigLocation
    classpath:applicationContext.xml
  

  
    springmvc

    org.springframework.web.servlet.DispatcherServlet
    
      contextConfigLocation
      classpath:spring-mvc.xml
    
    1
    true
  
  
  
    springmvc
    *.do
  


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

在mapper文件夹下新建xml文件





    

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/855223.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号