Courses
Module 1. Initialize Project
Module 2. REST services

Create Spring Boot Project

Create Spring Boot Project

To create a Spring Boot project, we will use the Spring Boot CLI.

sdk install springboot

Install the Spring Boot CLI:

java --version

Check that the currently installed Java version is 25.

sdk install java 25.0.1-tem
sdk use java 25.0.1-tem  

Install and use Java 25:

spring init \
--boot-version=4.0.0 \
--java-version=25 \
--build=maven \
--groupId=com.romach007 \
--artifactId=spring-boot-web-mvc \
--name=spring-boot-web-mvc \
--package-name=com.romach007.spring_boot_web_mvc \
--dependencies=web \
spring-boot-web-mvc

Create a Spring Boot project with Spring Web MVC dependency.

./mvnw clean package

Build the Spring Boot project.

java -jar target/spring-boot-web-mvc-0.0.1-SNAPSHOT.jar

Run the Spring Boot project.

Configure the Java version for a project

Add a .sdkmanrc file to the project directory:

java=25.0.1-tem

Enable switching SDK versions in the SDKMAN! config ~/.sdkman/etc/config:

sdkman_auto_env=true

After setting up the .sdkmanrc file, SDKMAN! will automatically switch to the required Java version when you cd into the project directory.

If the specified Java version is not installed, SDKMAN! will prompt you to install it.

Run the following command to install it:

sdk env install