How To Install Spring IDE Eclipse Plugin

Spring IDE is a useful graphical development tool. It can make Spring application development easy. This article will show you how to install it as an Eclipse plugin.

1. Install Spring Plugin From Eclipse Marketplace

  1. Open Eclipse, click the menu item Help —> Eclipse Marketplace.
  2. Input the keyword Spring IDE in the popup Eclipse Marketplace dialog Find input text box, click the Go button to search the plugin.
  3. Select the sts ( Spring Tools Suite ) eclipse plugin in the search result list.
  4. Click the Install button to install it. After a while, it will list all the sts ide required plugins. Click the checkbox to choose them all and click the Confirm button to continue.
  5. Select the checkbox Accept terms of license agreement in the next wizard, click the Finish button.
  6. When the sts plugin installation complete, you need to restart eclipse.
  7. After restart, you can see the eclipse ide Welcome page that shows the Spring IDE link (click to Create a new Spring project) , Spring Tool Suite Dashboard link( click to See the Tool Suite Dashboard) in it.
  8. If you do not see the eclipse Welcome page, you can click the eclipse Help —> Welcome menu item to show it.

2. Create Spring Java Project

  1. Open Eclipse, click File —> New —> Project menu item.
  2. Choose Spring / Spring Legacy Project ” in the popup New Project dialog. Click Next.
  3. Input Project name and browse to select Location ( project saved directory ) in the Spring Legacy Project wizard dialog.
  4. Select Simple Projects / Simple Spring Maven in the Templates drop-down list.
  5. After clicking the Finish button, you can see the project listed in Eclipse left panel.
  6. Because we choose the “Simple Spring Maven” template in step 3, so all spring-related jars have been added to the project, you can find them in the eclipse Project Name / Maven Dependencies.
  7. If you choose the “Simple Java” template in step 3, you need to add the jars manually. You can click here to download the latest jars.
  8. After download, unzip it to a local folder. Then add related jars into the java project. You can read Spring Hello World Example Use Maven And Eclipse to learn how to add the jars to the eclipse spring project.
  9. Spring uses commons-logging by default, so you need to click here to download the commons-logging jar lib file. Then add it to the project build path.

3. Create HelloWorld Java Bean.

  1. Right-click src/main/java, click New —> Class menu item in the popup menu.
  2. Input package name ( com.dev2qa.example.spring ), class name ( HelloWorld ) in the popup New Java Class dialog window.
  3. Input below java code in HelloWorld.java. Please note all the private instance fields should have a set and get method.
    public class HelloWorld {
    	
    	private String firstName;
    	
    	private String lastName;
    
    	public String getFirstName() {
    		return firstName;
    	}
    
    	public void setFirstName(String firstName) {
    		this.firstName = firstName;
    	}
    
    	public String getLastName() {
    		return lastName;
    	}
    
    	public void setLastName(String lastName) {
    		this.lastName = lastName;
    	}
    	
    	public void sayHello()
    	{
    		System.out.println("Hello " + this.getFirstName() + " " + this.getLastName());
    	}
    }
    

4. Create Spring Bean Configuration Xml File.

  1. Right-click src/main/resources in the left panel, click New —> Others in the popup menu list.
  2. Choose Spring / Spring Bean Configuration File in the popup dialog. Click the Next button.
  3. In the New Spring Bean Definition file dialog, click the Spring project/src/main/resources folder, input BeanSettings.xml in the File name text box, please note the XML file should be saved in the directory src/main/resources. Click the Next button.
  4. Select related XSD in the next dialog. We just select the spring beans XSD checkbox.
  5. Click the Next —> Finish button to close the wizard. You can see the spring bean configuration file src/main/resources/BeanSettings.xml has been created in the left eclipse spring project tree.

5. Add Java Bean To Bean Configuration File.

  1. Double click the src/main/resources/BeanSettings.xml file just created, it will open the BeanSettings.xml file in designer mode.
  2. Click the New Bean button in the right panel beans tab ( on the right side bottom area ).
  3. In the Create New Bean dialog Bean Definition wizard, input helloWorldBean in the Id textbox. Click the Browse button to select the com.dev2qa.example.spring.HelloWorld class we just created in step 3. Click the Next button.
  4. In the Properties and Constructor Parameters wizard window, add two Properties firstName value is jerry and lastName value is zhao.
  5. Click the Finish button, Now click Source tab at the bottom, you can see bean definition in xml format file.
    <bean id="helloWorldBean"
        class="com.dev2qa.example.spring.HelloWorld">
        <property name="firstName" value="jerry"></properry>
        <property name="lastName" value="zhao"></property>
    </bean>

6. Invoke HelloWorld Java Bean.

  1. Create class com.dev2qa.example.spring.InvokeHelloWorldBean.
  2. Add below java code in it.
    public static void main(String[] args) {
        /* Initiate Spring application context. */
        ApplicationContext springAppContext = new ClassPathXmlApplicationContext("BeanSettings.xml");
    
        /* Get HelloWorldBean by id. */
        HelloWorld helloWorldBean = (HelloWorld) springAppContext.getBean("helloWorldBean");
    		
        /* Set bean field value. */
        helloWorldBean.setFirstName("Lucky");
    		
        /* Call bean method. */
        helloWorldBean.sayHello();
    }
    
  3. Run it, then you can see the below output.
    Hello Lucky zhao

3 thoughts on “How To Install Spring IDE Eclipse Plugin”

  1. I am new to spring framework and I want to develop spring application use eclipse, so I want to install the spring framework eclipse plugin. I found there are two spring eclipse plugins, one is Spring IDE plugin and the other is Spring tool suite plugin. Can anybody tell me the difference between them? Which one should I install? Thanks.

    1. The spring tool suite plugin provides more tools for you to use when you develop a spring application in eclipse. For example, it provides maven, WTP add-ons, spring roo, and AJDT tooling. Of course, you can install those plugins by yourself one by one, but it is recommended to install and use the spring tool suite eclipse plugin which has integrated all the components that are needed when developing a spring application in eclipse. This can avoid plugins conflictions and easy to use.

  2. simple maven project does not any thing EXCEPT MANIFEST.MF in file explorer in eclpise in linux mint 19.2 cinnemon. I don’t understand why please, help me to sort out.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.