Spring Basic Code Running

Spring Basic Code Running

Here are the steps for the creation of the spring boot application:

  • Step 1: Start the Spring Initializr
  • Step 2: Select the Spring Boot version of your choice, like  2.2.2.BUILD-SNAPSHOT.
  • Step 3: Provide a Group name, like, com.javatpoint.
  • Step 4: Provide an Artifact, say spring-boot-application-run.
  • Step 5: Add any Web dependency for the Spring project.
  • Step 6: Click on the Generate button and then it will wrap all application-related specifications to a Jar file and then download the same to the local system.
  • Step 7: Extract jar files.
  • Step 8: Copy and paste the folder in the STS workspace.
  • Step 9: Import project by following the given sequence: File >> Import >> Existing Maven Projects >> Next >> Browse >> Select folder spring: spring-boot-application-run >> Select Folder >> Finish

    mporting the project takes time. We can see it in the IDE Package Explorer section when this project imports properly. You will notice that the file pom.xml and the other application.java file are created automatically.

    The xml file contains all the dependencies, name of the application, version of the Spring boot, group name, object, and other plugins. The main class is the main() method class. The ApplicationContext starts in the Spring. It's the class we run for the program to run.
  • Step 10: Creating the controller, say HelloWorldController.

Here is the running of the Spring Boot application:

Open the main application file and start it as a Java program to launch the Spring Boot application.

Please open your browser and call the Localhost URL. It indicates the message to the controller that we returned.