After the huge response and viewership for my earlier article https://dzone.com/articles/spring-boot-restful-web-service-example I have decided to write a new article with all the REST calls example respectively GET, POST, PUT and DELETE.
Prerequisites for this project:
-
If you have Eclipse, download the STS plug-in from here https://marketplace.eclipse.org/content/spring-tools-aka-spring-ide-and-spring-tool-suite
-
If you don’t have Eclipse, download STS from here https://spring.io/guides/gs/sts/
-
Download the latest JDK from here http://www.oracle.com/technetwork/java/javase/downloads/index.html
-
Also for testing please download and install SOAPUI tool from here https://www.soapui.org/downloads/soapui.html
The first example I am going to explain is about HTTP GET request, second example will be about HTTP POST request, third example about HTTP PUT request and fourth example is for HTTP DELETE request. In these entire examples I am going to use JSON Representation.
Before checkout this project create a folder under C drive like C:\Projects
Now open command prompt
- cd c:\Projects
- check out the mail branch
- cd spring-boot-rest-2
- Execute - mvnw clean package
- start the server - java -jar target\spring-boot-rest-2-0.0.1-SNAPSHOT.jar