Create Spring Boot application using IntelliJ

In IntelliJ there are two ways you can create spring boot application

  1. Using spring Initializr at https://start.spring.io
  2. Using spring Initializr in the IDE

Using spring Initializr at https://start.spring.io

Spring initializr is a great tool for creating a boiler plate spring boot application by following these simple steps

https:/start.spring.io
  • Choose project type Maven or Gradle. For our demo, I chose maven
  • Choose Language (Java/Kotlin/Groovy)
  • Spring boot version (Milestone/snapshot or stable)
  • Input project metadata Group, Artifact
  • Add any dependencies you need for the project (web, jpa, security etc.). I chose web for this demo
  • Click on generate project
  • We should be able to download and extract spring boot project

Upon downloading zip file from start.spring.io website, open your IntelliJ IDE and select File -> Open and choose the extracted folder to open spring boot project. After successfully importing, you should see similar screen as below

Using spring initializr in the IDE

You can create spring boot project either from welcome screen -> create new project or from IDE File -> New -> Project

Welcome Screen

On New Project Wizard select “Spring Initalizr” and click “Next”

Enter details as we did in the spring Initializr setup earlier “Using Spring Initalizr at https://start.spring.io” and click Next and select dependencies

Click next after selecting dependencies, name your project and click on finish

Now your IDE should open up the created project in the IDE as below.

Running spring boot project in IntelliJ

After creating spring boot project as detailed above, Open DemoApplication which is our main class and run using Run -> Demo Application or Shift + F10

Note that I have created a sample index.html under src/main/resources/static folder for demo purposes.

Now go to browser and try http://localhost:8080 and you should be able to see the running application as below

If you see above screen you have successfully created simple spring boot application using IntelliJ. Congratulations!