Step by Step Instructions

Get Starter Project from Spring Initializer

Step One

This will download a zip file containing a starter project to your hard drive.

Import Project Into IntelliJ

Step Two

Unzip the contents of the downloaded file to a working directory.

You now have a basic Spring project using Maven. The downloaded file contains the default Maven project structure. At the root of the directory is a pre-configured POM that contains a Spring Boot dependency. The Spring Boot dependency has child dependencies for Spring Core modules.

Step Three

Import project into your IDE. Our favorite IDE is IntelliJ.

From IntelliJ go to File / New / Project from Existing Sources.

Locate the file pom.xml in the root folder of the downloaded project and click OK.

Click next from the Import from Maven screen.

Select Maven Project, Click Next.

Select the SDK to use. (You should select Java 1.8 or higher)

Select name for the project. (Demo is fine for this)

At this point the Maven project has been imported into the IntelliJ IDE.

Newsletter

Join the Spring Guru Newsletter!

Stay updated on the latest and greatest happening at springframework.guru.

[mc4wp_form]

Update Code

Step Four

Create a HelloWorld class which will print ‘Hello World’ to the console in Java.

1

2

3

4

5

6

7

@Component

publicclassHelloWorld{

publicvoidsayHello(){

System.out.println("Hello World");

}

}

Step Five

Update the main method to get an instance of the HelloWorld bean from the Spring Context.