Create Java Spring Boot project in IntelliJ


Organize the steps to create a Spring Boot project in IntelliJ IDEA. This time, Java and Gradle will be used.


Project creation

Launch IntelliJ and click ** Create New Project **.

スクリーンショット 2020-06-19 0.06.56.png

Select Gradle, Java and click ** Next **.

スクリーンショット 2020-06-19 0.13.14.png

Create a project as SprintBootTest.

スクリーンショット 2020-06-19 1.49.36.png

Edit build.gradle

Build.gradle created in the project


plugins {
    id 'java'

group 'com.ykdevs'
version '1.0-SNAPSHOT'

repositories {

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'

Edit as follows. The latest version is specified from Spring Boot. Since IntelliJ is used, idea is specified for plugins. Reference JUnit uses JUnit5.


buildscript {
    ext {
        springBootVersion = '2.3.1.RELEASE'
    repositories {
    dependencies {

plugins {
    id 'idea' // IntelliJ
    id 'java'

group 'com.ykdevs'
version '1.0-SNAPSHOT'

repositories {

dependencies {
    // SpringBoot
    implementation "org.springframework.boot:spring-boot-starter-thymeleaf:${springBootVersion}"
    implementation "org.springframework.boot:spring-boot-starter-web:${springBootVersion}"
    testImplementation "org.springframework.boot:spring-boot-starter-test:${springBootVersion}"

    // JUnit
    testImplementation 'org.junit.jupiter:junit-jupiter:5.6.2'

Creating an application execution class

The following directories are created when the project is created.

├─ main
│  │
│  ├─ java
│  │
│  └─ resources
└─ test
   ├─ java
   └─ resources

Create a package under main / java.

スクリーンショット 2020-06-21 21.58.00.png

If you specify the package names separated by commas, the directory will be created automatically.

スクリーンショット 2020-06-21 22.22.16.png

Create an application class file in the package directory.

スクリーンショット 2020-06-21 22.05.29.png

Annotate @SpringBootApplication and create main function.

package com.ykdevs.springboottest;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

public class Application {
	public static void main(String[] args) {, args);

Right-click on the class name and select Generate to create a Test.

スクリーンショット 2020-06-21 22.11.30.png

スクリーンショット 2020-06-21 22.11.40.png

The test looks like the following.

package com.ykdevs.springboottest;

import org.junit.jupiter.api.Test;

class ApplicationTest {

	void main() {
		Application.main(new String[0]);

Run test with Run

スクリーンショット 2020-06-21 22.29.59.png

スクリーンショット 2020-06-21 22.30.26.png


Gradle User Guide Introduction to Spring Boot-Official Documents JUnit 5 User Guide

Recommended Posts

Create Java Spring Boot project in IntelliJ
Java tips-Create a Spring Boot project in Gradle
Create JSON in Java
View the Gradle task in the Spring Boot project
Create Azure Functions in Java
CICS-Run Java application-(4) Spring Boot application
Try gRPC in Spring Boot & Spring Cloud project (Mac OS)
Major changes in Spring Boot 1.5
NoHttpResponseException in Spring Boot + WireMock
[Java] [Spring] Spring Boot 1.4-> 1.2 Downgrade Note
Create microservices with Spring Boot
How to call and use API in Java (Spring Boot)
[Java] Sample project for developing web applications with Spring Boot
Create a Java project using Eclipse
(Intellij) Hello World with Spring Boot
Create an app with Spring Boot
Implement REST API in Spring Boot
What is @Autowired in Spring boot?
Implement Spring Boot application in Gradle
[Java] LINE integration with Spring Boot
Java + OpenCV 3.X in IntelliJ IDEA
Setting project environment variables in intelliJ
Thymeleaf usage notes in Spring Boot
Gradle Memorandum
Gradle installation
View the Gradle task in the Spring Boot project
Compare Hello, world! In Spring Boot with Java, Kotlin and Groovy
Spring Java
Loosen Thymeleaf syntax checking in Spring Boot
Create a TODO app in Java 7 Create Header
[Practice! ] Display Hello World in Spring Boot
Spring Boot + Docker Java development environment construction
Use DynamoDB query method in Spring Boot
DI SessionScope Bean in Spring Boot 2 Filter
(IntelliJ + gradle) Hello World with Spring Boot
[* Java *] I participated in JJUG CCC 2019 Spring
Change session timeout time in Spring Boot
Automatically deploy a web application developed in Java using Jenkins [Spring Boot application]
Let's create a super-simple web framework in Java
Use Servlet filter in Spring Boot [Spring Boot 1.x, 2.x compatible]
How to add a classpath in Spring Boot
Build Spring Boot project by environment with Gradle
Create CRUD apps with Spring Boot 2 + Thymeleaf + MyBatis
[Java] Hello World with Java 14 x Spring Boot 2.3 x JUnit 5 ~
Create your own Utility with Thymeleaf with Spring Boot
Spring Boot Form
How to bind to property file in Spring Boot
[JAVA] [Spring] [MyBatis] Use IN () with SQL Builder
[Java] Article to add validation with Spring Boot 2.3.1.
Spring Boot Memorandum
I tried to create Alexa skill in Java
Create Spring Boot environment with Windows + VS Code
Pi in Java
gae + spring boot
Create a web api server with spring boot
Annotations used in Spring Boot task management tool
LINE Bot x Java (Spring Boot) construction procedure
[Java] Spring DI ③
FizzBuzz in Java
Create a Spring Boot development environment with docker
Create Spring Cloud Config Server with security with Spring Boot 2.0
SSO with GitHub OAuth in Spring Boot 1.5.x environment
[Java] [Spring] [Spring Batch] Do not create / use Spring Batch metadata table