Creating a Simple Spring Application (original) (raw)

Last Updated : 27 Apr, 2026

Creating a simple Spring application helps developers understand how the Spring Framework simplifies Java development by managing dependencies and application flow. It provides a lightweight and flexible way to build scalable, maintainable applications.

**Prerequisites:

Step-by-Step Implementation

Follow these steps to build and run a simple application using the Spring Framework efficiently.

**Step 1: Create a Maven project

Let’s start by creating a simple Maven-based Spring project following step by step.

step1

step1

**Step 2: Project Structure

After creating the project successfully and adding the necessary dependencies to your Spring application. The project structure will looks something like this.

step1

step2

**Step 3: Add the Dependency to pom.xml File

Follow these steps below to add dependencies to pom.xml:

**pom.xml:

Java `

4.0.0 com.example spring-demo 1.0-SNAPSHOT org.springframework spring-core 5.3.29

<!-- Spring Context -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>5.3.29</version>
</dependency>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.11.0</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

`

**Step 4: Open the Main class and Run

Open the main class that contains the main method and run your Spring application. If everything is set up correctly, then your spring application will run successfully, and you will see the desired output on the console.

**App.java:

Java `

package org.vishnu;

public class App {

public static void main(String[] args)
{
    System.out.println("Hello World.");
}

}

`

**Output:

step3

step4