需要帮助以IntelliJ IDEA推动Spring MVC项目 [英] Assistance need to get Spring MVC project going with IntelliJ IDEA

查看:174
本文介绍了需要帮助以IntelliJ IDEA推动Spring MVC项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我下载了Ultimate Ultimate的试用版,我想让Spring MVC与tomcat一起使用.

So I downloaded a trial of idea ultimate, and I want to get spring mvc going with tomcat.

所以我设置了一个新项目,将其配置为使用sun jdk.

So I setup a new project, configured it to use sun jdk.

我选择了一个spring应用程序,它创建并下载了以下内容:

I chose a spring application, and it created and downloaded the following:

我没有看到任何spring-mvc库,它们是否包含在其中,或者我需要对此做些什么?

I don't see any spring-mvc libraries, are they included in there or do I have to do something about that?

有人可以概述我要做些什么来像Spring MVC Web应用程序那样进行构建吗?

Can someone outline what I have to do to get this to build like a spring mvc web application?

推荐答案

我发现启动新IDEA项目的最佳方法是使用Maven.这样一来,您无需启动IDE即可轻松构建项目,从而自动为您维护所有库.

I find that the best way to start a new IDEA project is to use the Maven. This allows you to easily build your project without launching the IDE, automatically maintaining all libraries for you.

从头开始创建项目",然后在下一个屏幕中选择"Maven模块".单击从原型创建",然后选择"maven-archetype-webapp".这将为您提供一个基本的Maven布局,该布局将构建一个简单的WAR文件.

"Create project from scratch", then select "Maven module" in the next screen. Click on "Create from archetype" and select the "maven-archetype-webapp". This will give you a basic Maven layout which builds a simple WAR file.

现在要添加Spring库,打开Maven构建文件-pom.xml-并在Spring MVC框架上插入新的依赖项:

Now to add the Spring libraries, open the Maven build file - pom.xml - and insert a new dependency on the Spring MVC framework:

   <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>3.0.0.RELEASE</version>
    </dependency>

在这里,您可以遵循

From here, you can follow the Spring MVC reference documentation - add the Dispatcher Servlet and Context Listener to web.xml, a Spring XML context and so on.

Maven Jetty插件 .配置完成后,您只需在命令提示符下键入"mvn jetty:run"即可运行您的应用程序(或从IDE中启动它). Maven将获取所需的所有信息并为您部署应用程序,而无需外部应用程序服务器设置即可进行快速测试.

Something else you might find useful is the Maven Jetty plugin. Once configured, you can run your app by simply typing "mvn jetty:run" at the command prompt (or launching it from within the IDE). Maven will fetch all that's required and deploy the app for you, no need for an external app server setup for quick testing.

这篇关于需要帮助以IntelliJ IDEA推动Spring MVC项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆