Spring Framework

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, 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

This tutorial will teach you how to build a Spring Boot application and access data in a MongoDB database using the MongoTemplate APIs.   For MongoDB, we will use mLab, which provides MongoDB Database as a Service platform so that you don’t even have to install a MongoDB database on your computer.  Also, at the end…

Read More Spring Boot and MongoTemplate Tutorial with MongoDB

In this tutorial, you will learn how to implement pagination in your RESTful Web Services application built with Spring Boot. The code example below will demonstrate how to implement pagination for the API endpoint that returns a list of users. I assume you already have your Spring Boot RESTful Web Service built, but if you…

Read More Pagination Tutorial with Spring Boot REST

This tutorial will teach you how to make your RESTful Spring Boot API endpoint respond with either XML or JSON representation. The client application can request our API endpoint to respond with JSON or XML by including a special HTTP Header called Accept. As a value, the Accept HTTP Header will have either application/json or application/xml. …

Read More Return XML or JSON in Spring Boot Web Service

In this Spring Boot REST tutorial, you will learn how to use the @PostMapping annotation to make your RESTful Web Service Endpoint able to handle HTTP Post requests and read its JSON or XML body payload. If you are also interested in using @GetMapping, @PutMapping and @DeleteMapping annotations, check the following tutorial “@PostMapping, @GetMapping, @PutMapping,…

Read More @PostMapping and @RequestBody Example in Spring Boot REST

With this Spring Boot tutorial, I will share how to handle exceptions in your RESTful Web Service application build with Spring Boot. Read the “Handling Exceptions in Project Reactor” tutorial if you use a project reactor. And to learn how to test your code for Exceptions, read the “Test for Exceptions with the JUnit” tutorial. What…

Read More Handle Exceptions in Spring Boot RESTful Service