Spring Project setup using annotation

This blog will help you to create a basic Spring project setup using annotation within 5 min and print the custom output on screen.

Install Java

First step required is to check either Java is installed in local or not. Please ignore below step if Java is installed.

If Java not installed please follow below link Install Java

Now, we are ready to create Spring project. We will be following two different ways to create Spring project.

  1. Using Spring tool suit -> This one is my favorite as it is more flexible and scalable. We can add module after project creation also.
  2. Using only start.spring.io

Install Spring tool Suit

Yes, as name suggest we are going to use Spring Tool Suit to create spring application.

1. Please go to link and navigate to Spring Tools 4 for Eclipse section and download the executable jar.

2. Go to download folder and double click on the downloaded jar. It process the Jar and create below sts-4.16.0.RELEASE folder depending on the downloaded version.

3. Go inside that folder as double click on the below highlighted SpringToolSuite4.exe file will open an application similar to Eclipse editor.

4. Click on File in top navigation menu and than click on new. There will be an option Spring Starter Project start appearing once we click on create new option.

Below window will start appearing.

Provide below highlighted value for Group and Artifact for the project and click on Next.

5. In the below screen select open Web option and select Spring Web. Click on Finish will create Spring project.

6. Create Person.java class as mentioned in below screenshot and write below code.

Go to DemoApplication.java class and right click to run code as Java application.

Go to Eclipse console and check for printed logs to check the port on which Spring application is running in below screenshot.

OUTPUT:

Imran Khan

Specialist Master (Architect) with a passion for cutting-edge technologies like AEM (Adobe Experience Manager) and a proven track record of delivering high-quality software solutions.

  • Languages: Java, Python
  • Frameworks: J2EE, Spring, Struts 2.0, Hibernate
  • Web Technologies: React, HTML, CSS
  • Analytics: Adobe Analytics
  • Tools & Technologies: IntelliJ, JIRA

🌐 LinkedIn

📝 Blogs

📧 Imran Khan