Thursday, October 26, 2017

Spring Boot Basic Setup

I had a chance to check with Spring boot today for the new app that I'm currently building.

Spring boot can be setup in 2 ways. Spring initializer and Spring starter project.

Since I have STS installed in my machine. I will be using the later (Spring start project) for this project.

Precondition:
  • Spring Tool Suite 3.8.3.RELEASE 
Steps:

Goto File-> New -> Spring Starter Project


Enter the following fields below and click the Next button.


In this example the Packaging option is set to JAR which means we will be using the build in tomcat container for our web application. If we want this deployed our app in a different server we can use the WAR  option instead.






























In the dependencies section expand CoreWeb, Ops and SQL. Select the following as shown below.

Once done. Click Finish.


Results should be similar to the folder structure below.
















How to run the application

1) Right click the root folder <contact-manager-sb>
2) Search for Run as and choose Spring Boot App



















Check the server logs you should have a similar output as shown below.





To check if tomcat is indeed running. Open a webrowser by typing localhost:8080.
















In Spring Boot Web there is no default index file that is why you will see a White label Error Page. You can fixed this issue by creating an index.html file and put it into the static folder of the application.















Cheers!! you have set up a Spring boot web app from scratch.

No comments:

Post a Comment