Newsletter

Spring Boot – RESTful Web Service with POST Request in JSON Example

Spring-Boot-Tutorials » on May 24, 2018 By Sivateja

In the previous articles I didn’t get a chance to use the POST request in the examples, but this is very important. In this article I am going to show you how to create a Spring Boot REST service with POST request in JSON format with a simple example.

As Spring Boot by default supports JSON request and responses, we no need to add any dependencies. A simple annotation called @RequestBody will do the trick for us ;)

pom.xml

SpringBootApp.java

Customer.java

SpringJava4sController.java

application.properties

Output

Run the application and open the URL in Postman
http://localhost:8080/spring-boot-restful-post-json/save-cust-info

Request:

Response:

 

You Might Also Like

  ::. About the Author .::

Java4s_Author
- Full Stack Java/J2EE & UI Web Developer
Founder of Java4s - Get It Yourself, A popular Java/J2EE Programming Blog, Love Java and UI frameworks.
You can sign-up for the Email Newsletter for your daily dose of Java tutorials.

Comments

Name*
Mail*
Website



By posting your answer, you agree to our comments policy.
Most Recent Posts from Top Categories
Hibernate Spring Struts
Contact | About Us | Privacy Policy | Advertise With Us

© 2010 - 2018 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.