Spring Boot currently support Java, Kotlin and Groovy as language preference to create an application. You can also choose Maven or Gradle as a build automation tool. You can choose your favourite IDE ranging from Netbeans, IntelliJ ,Eclipse or Spring Tool Suite.
\n\nWe will be using Java and Maven with Spring Tool Suite.
\n\nWe can create a Spring Boot application in different ways.
\n\n- \n
- Creating a maven project and adding dependencies\n
- Using Spring Tool Suite (STS )/IntelliJ built in feature\n
- Using Spring Initializr : https://start.spring.io\n\n
We will be using STS built in feature and will also look at Spring Initializr. In order to create first spring boot application using STS , click on File \xe2\x86\x92 New \xe2\x86\x92 Spring Starter Project.
It will open a popup , where default values can be modified.
\n\nWe have modified name, group ,artifact and package default values.
\n\nOnce modified as per your requirement ,click \xe2\x80\x9cNext\xe2\x80\x9d.
\n\nNow select Web from web stack and Devtools from Core stack.
Selecting Dev Tool is optional. It is just because of personal choice of not starting application again and again on saving the files. We will learn about DevTool later.
\n\nWeb is an obvious choice as we are going to learn a web based Spring Boot application.
\n\nClick Finish. Now we have a sample Spring boot application ready to go.
\n\n \n\nAfter clicking on finish , we will have project structure as shown in figure below.
\n\nHere UserServiceApplication.java inside com.codingsaint.userservice is the main class and entry point to our application.
\n\nEvery Spring Boot Application has a main class, which acts as the entry point to application.
\n\nLet\xe2\x80\x99s run it and see if Spring Boot application is really this easy to start and run. You can run it as a Java Application by right clicking on file and selecting Run as from menu and selecting \xe2\x80\x9c Java Application\xe2\x80\x9d or \xe2\x80\x9cSpring Boot App\xe2\x80\x9d as an option.
\n\nOnce you run it , you can see output as below on console ,where it does tell that application is running on port 8080.
\n\n \n\nIn browser open http://localhost:8080/ and verify if server is up. Following output with 404 (default 404 of Spring Boot application) tells that server is up and running and obviously we have nothing mapped to be displayed for base URL so we are seeing this 404 error page.
\n\nIn Next section , we will see how to handle incoming requests properly. We will also dive in Spring Boot Basics
\n\n\n