RESTful Web Services

In this tutorial, you will learn how to deal with an infinite recursion problem or circular reference, which occurs when you try to return an Object with Bidirectional Relationships in the HTTP response body. Infinite Recursion Problem Let’s look at an example that will cause an Infinite Recursion problem in our RESTful Web Service when we…

Read More Infinite Recursion in Objects with Bidirectional Relationships

This short tutorial will teach you how to roll back a database change using @Transactional annotation in your RESTful Web Service built with Spring Boot and JPA. Rollback with @Transactional Annotation Sometimes if an error occurs in our RESTful Web Service, we want to roll back the changes made. For changes to be rolled back…

Read More Rollback Using @Transactional in Spring with JPA

In this blog post, I am going to list commonly used POM.XML dependencies for building RESTful Web services with Spring Boot and Spring MVC. The list of below dependencies is not complete and will depend on the functionality you need your RESTful Web Services to support. But if you are building a simple REST API…

Read More Common POM.XML Dependencies for RESTful Web Services

The list of below video tutorials is a Quick Start to learning How to Build RESTful Web Services with Spring Framework. Spring Framework is large and there is so much to learn about it. And although there are so many tutorials on the Internet I still felt it would be helpful to create a series…

Read More RESTful Web Services with Spring Framework. Video Tutorials

In this tutorial on Rest Assured, I am going to share with you how to create a test case which sends HTTP Get Request and includes two Query String Request Parameters. Let’s assume we need to test a RESTful Web Service Endpoint which returns a list of users. The URL to our RESTful Web Service…

Read More Rest Assured HTTP Request with Query Parameters

In this tutorial, you will learn how to validate the request body of an HTTP Post request sent to a RESTful Web Service endpoint built with Spring Boot. Request Body JSON Let’s say you have a RESTful Web Service endpoint that accepts HTTP post requests with the following JSON payload: { “firstName”: “Sergey”, “lastName”: “Kargopolov”,…

Read More Validate Request Body in RESTful Web Service

In this tutorial, you will learn how to make a method in your Rest Controller class return a custom HTTP status code. To return a specific HTTP status code from a Spring Controller method in your application, you can use the ResponseEntity class. ResponseEntity with HTTP Status Code Let’s assume we have a simple web…

Read More Return Custom HTTP Status from Spring Controller

In this short tutorial, I am going to share with you how to enable CrossOrigin in a RESTful Web Service API built with Spring Boot that also has Spring Security enabled. Enable CrossOrigin for Specific Endpoint  To enable cross-origin AJAX HTTP requests to a specific RESTful Web Service endpoint in our Rest Controller class we can use…

Read More CrossOrigin and CORS in RESTful Web Service

In this tutorial, we will create a Spring Boot application which demonstrates how we can add and use the H2 in-memory database in our application. You will learn how an in-memory database like H2 can be used to develop a Spring boot application without the overhead of doing DB configuration on your machine and without…

Read More Using H2 In-memory Database in Spring Boot