This blog post demonstrates how to create Java Spring Boot applications in IntelliJ. As you may not know yet, Spring Boot allows for rapid development of applications. One of the important benefits of using Spring Boot is that it bundles all tested compatible versions of jar files.
The was a time when developers need to ensure various library files were compatible or rely on a list of known versions that work.
I am using a licensed version but I believe 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 Project
1. Open IntelliJ. Then, choose File > New > Project…
A window opens. Choose Spring Initilzr.
If you don’t have IntelliJ installed, head to https://start.spring.io using a web browser. It will enable you to generate 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
Your Spring Boot Application
At this point, we have a working application. To run it from the IDE, just execute the following class.
Run Your Spring Boot Application
For simplicity, you would execute the main class shown on the screenshot below.