Using Spring Boot is the fastest way to get up to speed in developing modern applications. But how do we create the initial codebase that works out of the box? There are three ways – by hand, the Spring Initialzr, and the IntelliJ IDE. This post shows how to create Java Spring Boot applications in IntelliJ. As you may not know yet, Spring Boot allows for the rapid development of applications. One of the essential benefits of using Spring Boot is that it bundles most of the dependencies we need.
The was a time when developers needed to ensure various library files were compatible or rely on a list of known versions that worked.
I am using a licensed version, but the Community Edition would provide enough features for our purpose.
IntelliJ IDEA 2016.3
Build #IU-163.7743.44, built on November 18, 2016
Licensed to ******************************
You have perpetual fallback license for this version
Subscription is active until June 25, 2018
JRE: 1.8.0_101-b13 amd64
JVM: Java HotSpot(TM) 64-Bit Server VM by Oracle Corporation
Create a new Spring Boot Project
1. Open IntelliJ. Then, choose File > New > Project…
A window opens. Choose Spring Initilzr.
Suppose you don’t have IntelliJ installed; head to h https://start.spring.io using a web browser. It will enable you to generate the Spring Boot application online and download the project as a zip file.
Then, click Next.
2. Specify details for the build system
Specify some details for the build system. We can even select which build system to use – Maven or Gradle (see Type field). Then, click Next.
3. Choose Dependencies
Instead of dealing with jar dependencies directly, we now deal with “module” dependencies. Each “module” is a bundle of related jar files.In this post, we select “Web” and “Thymeleaf.” Then, click Next.
4. Complete the process
Run Your Spring Boot Application From IntelliJ
At this point, we have created a Spring Boot application that works, and we can run it from the IntelliJ IDE. To run it from the IDE, execute the following class.
For simplicity, you would execute the main class shown in the screenshot below.
Hereafter, we can work on databases or even queues. And that’s how we create a Spring Boot application within the IntelliJ IDE!
Create Spring Boot in IntelliJ Demo
Here is a quick demo of creating a Spring Boot application in IntelliJ.