Logo
Creating a Project
Creating a ProjectManual Setup

Manual Setup

While Spring Initializr offers a quick and easy way to create Spring Boot projects, you might sometimes prefer to set up your project manually. This approach gives you complete control over your project's structure and dependencies. Below are the steps to manually create a Spring Boot project using Maven and Gradle.

Maven Manual Setup

  1. Create New Maven Project: Open your preferred IDE and create a new Maven project.

  2. Edit POM.xml: Open the pom.xml file and add the Spring Boot parent dependency to enable Spring Boot features.

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.5</version>
    </parent>
  3. Add Dependencies: Add the Spring Boot starter dependencies you need for your project. For example, for a web application:

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>
  4. Build Project: Run the Maven build command to download the dependencies and compile the project.

    mvn clean install
  5. Run Application: Execute the main class containing the SpringApplication.run() method to start your Spring Boot application.


Gradle Manual Setup

  1. Create New Gradle Project: Open your IDE and create a new Gradle project.

  2. Edit build.gradle: Add the Spring Boot Gradle plugin and the required dependencies in the build.gradle file.

    plugins {
        id 'org.springframework.boot' version '2.5.5'
    }
     
    dependencies {
        implementation 'org.springframework.boot:spring-boot-starter-web'
    }
  3. Refresh Dependencies: In your IDE, refresh the Gradle project to download the necessary dependencies.

  4. Run Application: Locate the main class with the SpringApplication.run() method and execute it to start your Spring Boot application.


Manually setting up a Spring Boot project offers the advantage of understanding the underlying configuration and dependencies. It's a good approach if you want to dig deep into the Spring Boot framework and customize it to fit your specific needs.

Book a conversation with us for personalize training today!

Was this helpful?
Logo