Friday, July 7, 2017

Spring Boot application Example

As we know that there are various ways for creating Spring Boot application. For this sample application, I am going to use STS (Spring Tool Suite) IDE.

  • Create a new project by selecting spring starter project wizard

  • Select project type as Maven, provide project name, packaging, and Java version etc.

  • Select spring boot version and project dependencies

  • After finishing, you can see the project structure as shown below

  • Spring boot generates a Java file in the src/main/java directory, pom.xml file with all required dependency. 

  • To handle HTTP request, Create a Controller class

  • Now run the as a Java application. It will start the tomcat server on default port i.e. 8080

  • Open browser and hit url http://localhost:8080/application

By Default, Application will start on port 8080 but can override by adding server.port to file.

Happy Coding..!!!

No comments:

Post a Comment

How TOPT Works: Generating OTPs Without Internet Connection

Introduction Have you ever wondered how authentication apps like RSA Authenticator generate One-Time Passwords (OTPs) without requiring an i...