开发者

Spring Hello World setup and code in eclipse

I have setup Spring / WTP in eclipse as well as successfully started a Tomcat 6 server within eclipse. I'm at the point where I can create a new Spring project and add source files as necessary.

Could somebody please describe (or point me to) how I can setup of some sort of 'Hello World' test a开发者_如何学运维nd how to run it? I have experience developing in Java SE but am trying to learn Java EE / Spring.


Start with "Spring MVC Step by Step".


I know this does not answer your question directly, but you may want to consider generating a base project using Maven and then generating an Eclipse project from that.

If you decide to go down the Maven path, the process would be:

  • mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-spring-archetype -DarchetypeVersion=2.1.0-M1 -DgroupId=com.mycompany -DartifactId=myproject

Details: AppFuse

Once you run the above command, it will set up a complete maven project for you with a Spring MVC project stubbed out.

  • The next step is to simply run: mvn eclipse:eclipse to generate the project.

Details: Maven Eclipse Plugin

Once you get the code generated and the Eclipse project set up, you can read on the AppFuse Quickstart page how to run the application locally, how to debug it, and go from there.


If you're looking at using Spring in a Web-app, then perhaps this previous answer I wrote might help?


For building Spring apps, SpringSource provides a build of Eclipse 3.5 called SpringSource Tool Suite. It includes a bunch of plugins that you can download independently, but this comes with them pre-integrated. It also includes a lot of guides, documentation, wizards, and so on, which might be good to get you started.


You may find interesting the Spring Roo project which creates a Spring MVC based project directly on the IDE or via the command line.

You might want to see the ten minute video to see how it can get you up and running in no time and it also includes other features which can be not that easy to set up like security and internationalization.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜