maven搭建spring項(xiàng)目(圖文教程)
開(kāi)發(fā)工具:MyEclipse2014版(jdk1.7)+Maven3.9。
新建Maven項(xiàng)目:
Step1:
Step2:
Step3:這里選maven-archetype-webapp,因?yàn)楹竺娴捻?xiàng)目講解都是web項(xiàng)目。如果是純java項(xiàng)目,可以選擇 maven-archetype-quickstart。
Step4:
Step5:右鍵項(xiàng)目,build path,修改jdk運(yùn)行環(huán)境。
到這里,maven的web項(xiàng)目初建完畢。
修改:pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.elstar</groupId> <artifactId>spring</artifactId> <packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <name>spring Maven Webapp</name> <url>http://maven.apache.org</url> <!-- jar包版本控制 --> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <junit.version>4.12</junit.version> <spring.version>4.3.3.RELEASE</spring.version> </properties> <dependencies> <!-- junit支持 --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${junit.version}</version> <scope>test</scope> </dependency> <!-- spring支持 --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${spring.version}</version> </dependency> <!-- spring測(cè)試支持 --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>${spring.version}</version> </dependency> </dependencies> <build> <finalName>spring</finalName> </build> </project>
添加spring配置文件:src/main/resources/applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd"> </beans>
以上這篇maven搭建spring項(xiàng)目(圖文教程)就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
java中的阻塞隊(duì)列應(yīng)用場(chǎng)景及代碼實(shí)例
這篇文章主要介紹了java中的阻塞隊(duì)列應(yīng)用場(chǎng)景及代碼實(shí)例阻塞隊(duì)列是一種特殊的隊(duì)列,它提供了線程安全的操作,并在隊(duì)列為空或滿時(shí)提供了阻塞的功能,阻塞隊(duì)列通常用于多線程場(chǎng)景,其中生產(chǎn)者線程向隊(duì)列中添加元素,而消費(fèi)者線程從隊(duì)列中獲取元素,需要的朋友可以參考下2024-01-01創(chuàng)建SpringBoot工程并集成Mybatis的方法
這篇文章主要介紹了創(chuàng)建SpringBoot工程并集成Mybatis,需要的朋友可以參考下2018-06-06Java面向?qū)ο髮?shí)現(xiàn)汽車租賃系統(tǒng)
這篇文章主要為大家詳細(xì)介紹了Java面向?qū)ο髮?shí)現(xiàn)汽車租賃系統(tǒng),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2022-02-02使用mybatis插件PageHelper實(shí)現(xiàn)分頁(yè)效果
這篇文章主要為大家詳細(xì)介紹了使用mybatis插件PageHelper實(shí)現(xiàn)分頁(yè)效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-01-01Java中處理金額計(jì)算之使用Long還是BigDecimal詳解
在Java后端開(kāi)發(fā)中處理與錢有關(guān)的業(yè)務(wù)時(shí),確保金額計(jì)算的準(zhǔn)確性和避免錯(cuò)誤非常重要,這篇文章主要給大家介紹了關(guān)于Java中處理金額計(jì)算之使用Long還是BigDecimal的相關(guān)資料,需要的朋友可以參考下2024-07-07利用微信小程序+JAVA實(shí)現(xiàn)微信支付的全過(guò)程
微信支付是一種在線支付解決方案,允許用戶通過(guò)微信內(nèi)的支付功能進(jìn)行付款,下面這篇文章主要給大家介紹了關(guān)于利用微信小程序+JAVA實(shí)現(xiàn)微信支付的相關(guān)資料,需要的朋友可以參考下2024-08-08淺談SpringSecurity注解與AOP切面執(zhí)行順序
這篇文章主要介紹了淺談SpringSecurity注解與AOP切面執(zhí)行順序,引入Spring Security后,在Controller的方法中會(huì)出現(xiàn)Spring Security的方法注解與AOP同時(shí)存在的問(wèn)題,這是就會(huì)設(shè)計(jì)順序問(wèn)題,需要的朋友可以參考下2023-10-10Spring注解驅(qū)動(dòng)之AOP功能測(cè)試
這篇文章主要介紹了Spring注解驅(qū)動(dòng)之AOP功能測(cè)試,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-04-04