Book Image

Mastering Spring Application Development

By : Anjana Mankale
Book Image

Mastering Spring Application Development

By: Anjana Mankale

Overview of this book

Table of Contents (19 chapters)
Mastering Spring Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

RestfulWebService using Spring Boot


In this section, let's develop a simple restful service and bootstrap the application using SpringBoot. We will also create a simple restful service that will store the product information into the database.

The Product creation scenario should satisfy the following mentioned use cases:

  • Given that no product with the same Product_id exists, it should store a new product in the database and immediately return the stored object.

  • Given there exist a product with the same Product_id, it should not store, but return an error status with the relevant message.

  • Given there are previously stored products, it should be able to retrieve the list of them.

Following is the of pom.xml file, for the dependency reference used in the application. You can see that we have used the parent Spring boot reference here, so that we can resolve all the dependency references. We have also set that Java version as 1.7 in the pom.xml file.

<project xmlns:xsi="http://www.w3.org/2001...