Spring boot - 02

Let's Create a Simple Rest Web Service


01.Preparation 

Hi all,

Today we are going to start hands-on on our first spring boot rest web service.

Requirements...

  • Java 1.8 or above.
  • Gradle for dependency management
  • Spring CLI v2.2.1.RELEASE
  • Mongo DB
  • Spring too suite (STS) 
You can use Maven instead of Gradle if you want. If you still don't know what Maven/Gradle is, check this post[link]. Instead of using STS you can use IntelliJ IDEA if you want. But in here all the steps I have mentioned are for STS. 

Here is the spring installation guide to get Spring boot CLI. Spring boot CLI installation

So if you are all set with the above requirements. 

STEP -01


Open STS and File -> new Project

Select Spring Starter Project. Click next. 
You'll get the window "New Spring Starter Project". Give a Proper Name for the Project. 

Since I'm going to create a service that we can save/get movie details.

So I name it as MovieService. Come up with a proper name according to your use-case. 


I leave other things as it is since I am going to use Gradle as my dependency management tool. If you want it changed the change in the dropdown in Type.  

Click Next. Now You will be redirected to the "New Spring Starter project dependencies". 

Hmm, now you need to think about what actually we are going to develop. For this project, I'm going to use Mongo DB as my database. Ah, you don't know about it? Well. You don't want to worry, Here Use this introduction to Mongo DB to get an idea about what it does. 


Search "Spring Web" and "Spring Data Mongo DB" dependencies and select them by ticking. Click finish. And you will get your first Spring boot project. 

Just Go through the structure and you'll see there are some generated codes also. Just Eyeball them now and try to understand. If you are not getting it don't worry. we will talk about those in the next blog post.


Comments

Popular Posts