How to Create a Springboot Project

Written by hassantarar | Published 2023/10/18
Tech Story Tags: programming | java | spring-boot | gradle | spring-boot-guide | java-tutorial | spring-boot-tutorial | creating-a-spring-boot-project

TLDRGo to the following website to create the project. Select Java as the language. An IDE (Spring Tool Suite) is recommended. Select the dependencies you want to add. Run the project by Gradle or Maven to build it in IntelliJ. The project will then be available on GitHub.via the TL;DR App

Prerequisites:

  1. Java Programming basics
  2. Spring Tool SuiteĀ (STS) IDE.
  3. Java 1.8
  4. Maven 3.0+
  5. Spring Framework 5.0.0.BUILD-SNAPSHOT
  6. An IDE (Spring Tool Suite) is recommended.

Creating the Project

Go to the following website

https://start.spring.io/

In the Project section, you can either select Gradle or Maven (comparison in details coming soon).

Select Java as the language.

Now, select the Springboot version. Above, the selected version of Springboot is 3.1.4

Now, in the project Metadata section:

  • You can enter the name of the project and the description
  • Select the Java version.
  • From the dependency section, search for the dependencies you want to add to the project.

The Most Popular Dependencies:

  1. Spring Boot Starter Web Provides the core Spring Boot functionality, including a web server, auto-configuration, and dependency management. implementation 'org.springframework.boot:spring-boot-starter-web'

  2. Spring Boot Starter Actuator

Provides a set of endpoints that expose information about your Spring Boot application, such as health checks, metrics, and thread dumps. `implementation 'org.springframework.boot:spring-boot-starter-actuator'`

  1. Spring Boot Starter Data JPA

Provides support for connecting to and interacting with relational databases using JPA. `implementation 'org.springframework.boot:spring-boot-starter-data-jpa'`

  1. Spring Boot Starter Security Provides support for adding security features to your Spring Boot application, such as authentication, authorization, and CSRF protection. implementation 'org.springframework.boot:spring-boot-starter-security'

  2. Spring Boot Starter Test Provides support for testing your Spring Boot application using JUnit. implementation 'org.springframework.boot:spring-boot-starter-test'

  3. Lombok Provides a number of annotations that can make your Java code more concise and readable. implementation 'org.projectlombok:lombok'

  4. Mockito Provides a mocking framework that can be used to mock objects in your Spring Boot application for testing purposes. implementation 'org.mockito:mockito-core'

  5. AssertJ Provides a set of assertions that can be used to test the state of your Spring Boot application. implementation 'org.assertj:assertj-core'

  6. JUnit Jupiter Provides a set of extensions to JUnit 5 that make it easier to write unit tests. implementation 'org.junit.jupiter:junit-jupiter-api'

  7. Spring Boot DevTools Provides a number of features that can be helpful during development, such as live code reloading and automatic restart of the application when changes are made to the code. implementation 'org.springframework.boot:spring-boot-devtools'

After adding the dependencies, download the project, and open it in the IDE.

Build the project and Run it.


Written by hassantarar | Software developer
Published by HackerNoon on 2023/10/18