Configure Eclipse IDE for Spring Development (January 7, 2012)

Posted: January 7, 2012 by Mike Hubbartt in Development
Tags: , , ,

By Mike Hubbartt, © Copyright 2012, All Rights Reserved.

Spring is a nice Java framework that simplifies J2E tasks, and is in wide use in many real-world business development environments. If you don’t know it and want to do dynamic web development with Java, this is a good time to learn it.

You need a couple of things to do Spring development. A good IDE, Tomcat for local development, and a good database for dynamic content. I enjoy using Eclipse IDEs, so this Spring setup procedure covers Eclipse Indigo.

Spring Configuration

  1. Download and install Eclipse Indigo from http://www.eclipse.org.
  2. Download and install Tomcat 6 from http://tomcat.apache.org/.
  3. Download and install a relational DBMS like MySQL or SQL Anywhere for Developers.
  4. Download the Spring framework with dependencies (for this example, I downloaded Spring 2.5 RC2) from http://www.springsource.org/download and then unzip the file into a folder. I keep all of my Spring files a folder surprisingly called Spring – it holds the Spring framework files and any Spring-specific articles I find to be useful as references.
  5. Download the Spring plug-ins by
    1. Using Help – Install New Software.
    2. At the Install pop-up, select the Add button.
    3. At the Add Repository pop-up, use Spring for the name and http://dist.springframework.org/release/IDE as the location.
    4. Select Core/Spring IDE and Resources/Spring IDE, then press the Next button.
    5. Select the Next button.
    6. Select the ‘I accept…’ licensing option and then press the Finish button.
    7. Restart Eclipse when prompted after the plug-in is installed.
  6. In Eclipse, select File – New – Other, then select Dynamic Web Project, then press the Next button.
  7. Enter a Project Name, then press the Finish button.
  8. You have 2 options: create a WAR directory or use the existing WebContent folder. If you want to use the WebContent folder, skip to step 11, otherwise continue with this step. Create a war directory in the project – this is where non-Java source (.JSPs, XML, etc) are stored. In Eclipse, use File – New – Folder, and enter ‘war’ as the folder name, then press the Finish button.
  9. In the new war folder, create a WEB-INF folder using File – New – Folder just as you did in step 8.
  10. In the new WEB-INF folder, create a lib folder using File – New – Folder just as your in step 8.
  11. Time to configure the build path:
    1. Highlight the project name in the IDE, right mouse click (Mac users use Control-mouse click for the same list), then select build path/configure build path.
    2. At the Properties dialog box, select the Java Build Path option at the left of the dialog, then select the Source tab.
    3. Select the ‘Add Folder’ button, then select the ‘war’ folder – do not select the folders below war, then select the OK button.
  12. Now add 2 JARs to the project.
    IMPORTANT NOTE: Starting with Spring 3.1.0, there is no longer a Spring.jar file, so this process is best used with pre-3.1.0 Spring.

    1. Using Windows Explorer, locate the Spring.jar file, then drag and drop it onto the war/WEB-INF/lib folder in Eclipse.
    2. Using Windows Explorer, locate the commons-logging.jar file, then drag and drop it onto the war/WEB-INF/lib folder in Eclipse.
    3. With the project name highlighted, select File – Refresh from the Eclipse menu options.
  13. You are done – the project is ready to be used as a blank Spring project.
Advertisements
Comments
  1. Sritej says:

    Really simply superb article….

  2. Boopathy Balakrishnan says:

    Excellent explanation 🙂

  3. Praveen says:

    Thanks boss, Its really very helpful for beginners 😉

  4. DHARMENDRA says:

    very much helpful….i really thanks to author as it helps me a lot….

  5. ashish says:

    thanks a lot for help pls find more info on http://techonology.boostr.in

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s