springjava.com
  • Core Java
  • Spring Core
  • Spring Boot
  • Spring MVC
  • Angular Tutorial

Related Posts

  • Registration, Login and Logout Web Application - Spring Security Login and Registration REST API with Spring Security Spring Security Login Rest API with Database Authentication Spring Security Login With Database Authentication in Spring Boot Spring Security Role-Based Authorization in Spring Boot Spring Security Customise Login and Logout in Spring Boot Example Spring Security Form-Based Authentication in Spring Boot Spring Security in Memory Authentication in Spring Boot Spring Security Basic Authentication to Secure REST APIs Spring Boot Annotations
Spring Boot

How to create a Spring Boot project in IntelliJ IDEA

Last Updated: 23-01-2023 Springjava

In this topic, we will create a Spring Boot Project in the IntelliJ IDEA Community Edition. We will learn to create Spring Boot Project and Run it step-by-step in IntelliJ IDEA. 

Table of content
1. How to create a Spring Boot Project in IntelliJ IDEA?
2. How to set up an example Spring Boot Project in IntelliJ IDEA?
3. Project Structure of  Spring Boot Project
4. How to run a Spring Boot Project in IntelliJ IDEA?
5. Conclusion

1. How to create a Spring Boot Project in IntelliJ IDEA?
We are creating Spring Boot Project through Spring Initializr. These are the following steps:
 • Select a Building tool like Gradle or Maven for the project
 • Select a language like Java or Kotlin or Groovy for the project
 • Select a Spring Boot version for the project
 • Provide project details like name, package etc.
 • Add dependencies according to our requirements for the project
 • Select packaging like war or jar of the project
 • Select the Java version for the project
 • Hit the Generate button to download the zip of the project

2. How to set up an example Spring Boot Project in IntelliJ IDEA?
Unzip that downloaded project into your workspace folder. We have to follow some steps to set up this project in Intellij IDEA:

how_to_create_a_spring_boot_project_in_intellij_idea

1. Click on the Open Folder Image
2. Browse the project folder location

how_to_create_a_spring_boot_project_in_intellij_idea

3. Project Structure of Spring Boot Project

how_to_create_a_spring_boot_project_in_intellij_idea

pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-starter-parent</artifactId>
     <version>2.7.7</version>
     <relativePath/> <!-- lookup parent from repository -->
  </parent>
  <groupId>com.example</groupId>
  <artifactId>demo</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>demo</name>
  <description>Demo project for Spring Boot</description>
  <properties>
     <java.version>1.8</java.version>
  </properties>
  <dependencies>
     <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
     </dependency>
     <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
     </dependency>
  </dependencies>
  <build>
     <plugins>
        <plugin>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
     </plugins>
  </build>
</project>

SpringBootApplication class:

package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
  }
}

4. How to run a Spring Boot Project in IntelliJ IDEA?
Right-Click on the SpringBootApplication class then click on Run. See the console output project is running successfully.

5. Conclusion
In this topic, we learnt about how to create Spring Boot Project using Spring Initializr and set up Spring Boot Project in IntelliJ IDEA.
 

What is Spring Boot How to Create a Spring Boot Project in IDE Spring MVC with Spring Boot Configure

Leave your thought here

Your email address will not be published. Required fields are marked *

springjava_com
  • springjava.com
Learn
    • Core Java
    • Spring Core
    • Spring Boot
    • Spring MVC
    • Angular Tutorial
Quick links
  • About Us
  • Contact Us
  • Privacy Policy
© 2021 Spring Java. All Rights Reserved.
springjava.com
  • Core Java
  • Spring Core
  • Spring Boot
  • Spring MVC
  • Angular Tutorial
  • About Us
  • Contact Us