Skip to main content
Advertisement

2.2 Project Setup

Learn how to create your first Spring Boot project and configure it in your local environment using the fastest and most standardized method: 'Spring Initializr'.

1. Accessing Spring Initializr

This is the official project creation page provided by the organization that manages the Spring ecosystem. Go to https://start.spring.io/.

2. Choosing Initial Configuration Options

Select the following configuration options on the web screen according to your development purpose. Below is the recommended standard production build environment.

Project & Language

  • Project: Gradle - Groovy (The tool that manages dependencies. Currently, in production, Gradle is overwhelmingly preferred over the traditional Maven.)
  • Language: Java (Based on the Java language)

Spring Boot Version

  • Choose the latest version with just pure numbers (e.g., 3.4.1) without (SNAPSHOT), (M1), or (RC1) in parentheses. This means it is the stable release version.

Project Metadata

  • Group: It is a convention to write the company's domain name in reverse. (e.g., com.example)
  • Artifact: The name of the project's output. A combination of lowercase English letters and hyphens (-) is recommended. (e.g., my-first-app)
  • Name: The display name of the project. (e.g., my-first-app)
  • Description: A description of the project. (e.g., Demo project for Spring Boot)
  • Package name: The default package hierarchy structure. (Automatically combined as Group + Artifact)
  • Packaging: Jar (Spring Boot can package the built-in Tomcat into a single Java executable file (Jar).)
  • Java: Match the Java version installed in your environment. (Use 17 or above, the current LTS standard).

3. Adding Dependencies

This is the most critical part. You can add the necessary libraries (Starter modules) for development as if putting them in a shopping cart. Click the Add Dependencies button.

  1. Spring Web: Mandatory item. This adds the internal Tomcat server, the Spring MVC engine (REST API), and the JSON mapping library (Jackson) all at once.
  2. Lombok: An essential library in Java development that automatically generates Getter, Setter, and Constructor code with just a single annotation.

4. Downloading the Project and Opening in IDE

  1. When all settings are complete, click the [GENERATE] button at the bottom left to download the .zip file.
  2. Move the file to the folder and unzip it.
  3. Launch IntelliJ IDEA.
  4. From the File -> Open menu, locate and open the build.gradle file inside the unzipped folder.
  5. If it asks whether to "Open as Project," accept it, and wait patiently until the progress bar at the bottom of the IDE (Gradle sync) is completely finished. (The initial loading takes 1-2 minutes).

5. Execution Check

Open the src/main/java/com/example/.../Application.java file (the class with the green play button) and click Run. If the Spring banner below is printed to the bottom console and ends without any error logs, you are ready to go!

  .   ____          _            __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
...
Started Application in 2.15 seconds
Advertisement