logo image

Create Spring Boot Application in eclipse

Steps to Create Spring Boot Application in eclipse:

Maven Integration with Eclipse

1) Need to add Spring tool suit plugin to the eclipse Help - > Eclipse Market Placle -> Find (Spring tool suit) -> Install

2) Create Maven Project. Click 'File' -> 'New' -> 'Other' -> 'Maven Project' and then click 'Next'. 3) Open the pom.xml and add below dependen cies


Note: Parent section tells to maven what type of configuration need by spring boot and which versions jars required to download from the repository. Web dependencies tells to the maven to enable the webmvc feature.

If we will change parent section version id then automatically spring boot will download corresponding versions jars like tomcat, spring mvc, spring security jdk etc… No need to download the version dependencies jars manually , spring boot will automatically get the dependencies jars .

4) If you want to change jdk version you can add below dependencies in the same pom.xml


5) Update the project Rightclick on the project -> Maven -> Update Project. 6) Create the simple java class which should have main method like below, and we should apply the annotation which is @SpringBootApplication

public class App 

	    public static void main(String[] args) throws Exception {

// Below line code is heart of the spring boot. Run as static method in SpringApplication Class. 

	        SpringApplication.run(App.class, args);

In the above code we have written SpringApplicaton.run(….) which is bootstrap the spring application . We should pass two argument to this method first one is classname.class where main method is available (App.class) and second argument is string array.

Note: Why Spring people providing this facility because we can test the application very easily with the main method ,no need install the server and configure it into eclipse, start the server ,without required all these stuff we can run the application. Run the spring boot Application

  • Now you can run the application as you run normal java class. When we are run the application spring boot will start the server and will create Servlet Container also.
  • Now you can test the application in the browser by using localhost:8080 which is given by spring boot.