Springboot- basic Rest API service

  1. Go to https://start.spring.io/ and select below option and add dependencies:

two dependencies have been added , one SPRING WEB for creating rest web app and H2 DB for creating in memory DB, which is needed for our tutorial.

2. click on generate button and download the zip.

3. unzip it to folder and open with any IDE like Intellij , VS code etc.

4. create controller folder inside JAVA folder and create HelloController.java inside controller as shown below :

HelloController.java as shown below :

5. Run below command from your terminal:

Once the tomcat server is up and started on port 8080 as shown in log below

The output will be viewed in http://localhost:8080/ in browser

Great !

You are done with your first SpringBoot REST API service.

Note: if you want to start on some other tomcat port like 8082. just go to application.properties and type below code:

once done , just restart the tomcat server. it will be hosted on 8082.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top