maven搭建spring项目(图文教程)

网友投稿 222 2023-05-11


maven搭建spring项目(图文教程)

开发工具:MyEclipse2014版(jdk1.7)+Maven3.9。

新建Maven项目:

Step1:

Step2:

Step3:这里选maven-archetype-webapp,因为后面的项目讲解都是web项目。如果是纯java项目,可以选择 maven-archetype-quickstart。

Step4:

Step5:右键项目,build path,修改jdk运行环境。

到这里,maven的web项目初建完毕。

修改:pom.xml

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

4.0.0

com.elstar

spring

war

0.0.1-SNAPSHOT

spring Maven Webapp

http://maven.apache.org

UTF-8

4.12

4.3.3.RELEASE

junit

junit

${junit.version}

test

org.springframework

spring-context

${spring.version}

org.springframework

spring-test

${spring.version}

spring

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

4.0.0

com.elstar

spring

war

0.0.1-SNAPSHOT

spring Maven Webapp

http://maven.apache.org

UTF-8

4.12

4.3.3.RELEASE

junit

junit

${junit.version}

test

org.springframework

spring-context

${spring.version}

org.springframework

spring-test

${spring.version}

spring

添加spring配置文件:src/main/resources/applicationContext.xml

xmlns:xsi="http://w3.org/2001/XMLSchema-instance"

xmlns:p="http://springframework.org/schema/p"

xmlns:aop="http://springframework.org/schema/aop"

xmlns:context="http://springframework.org/schema/context"

xmlns:jee="http://springframework.org/schema/jee"

xmlns:tx="http://springframework.org/schema/tx"

xsi:schemaLocation="

http://springframework.org/schema/aop http://springframework.org/schema/aop/spring-aop-4.0.xsd

http://springframework.org/schema/beans http://springframework.org/schema/beans/spring-beans-4.0.xsd

http://springframework.org/schema/context http://springframework.org/schema/context/spring-context-4.0.xsd

http://springframework.org/schema/jee http://springframework.org/schema/jee/spring-jee-4.0.xsd

http://springframework.org/schema/tx http://springframework.org/schema/tx/spring-tx-4.0.xsd">

xmlns:xsi="http://w3.org/2001/XMLSchema-instance"

xmlns:p="http://springframework.org/schema/p"

xmlns:aop="http://springframework.org/schema/aop"

xmlns:context="http://springframework.org/schema/context"

xmlns:jee="http://springframework.org/schema/jee"

xmlns:tx="http://springframework.org/schema/tx"

xsi:schemaLocation="

http://springframework.org/schema/aop http://springframework.org/schema/aop/spring-aop-4.0.xsd

http://springframework.org/schema/beans http://springframework.org/schema/beans/spring-beans-4.0.xsd

http://springframework.org/schema/context http://springframework.org/schema/context/spring-context-4.0.xsd

http://springframework.org/schema/jee http://springframework.org/schema/jee/spring-jee-4.0.xsd

http://springframework.org/schema/tx http://springframework.org/schema/tx/spring-tx-4.0.xsd">


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Express框架之connect
下一篇:使用spring实现邮件的发送实例(含测试,源码,注释)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~