Spring Boot

In this Spring MVC tutorial, you will learn how to read HTTP Request Header in the Rest Controller class of your Application. To read HTTP Request Header in Spring MVC application we use @RequestHeader annotation. @RequestHeader(value=”Accept”) String acceptHeader Reading HTTP Request Header For example, let’s assume we need to create a method in our Rest…

Read More Read HTTP Request Header in Spring MVC

In this Swagger tutorial, I am going to share with you how to add Contact and API information to your RESTful Web Service documentation created with Swagger. When adding Swagger to our RESTful Web Service, we usually create a new configuration Java Class which is then annotated with @Configuration annotation. Below is an example of…

Read More REST API Contact and ApiInfo with Swagger

In this tutorial, you will learn how to add Swagger or an OpenAPI support to your Spring Boot project so that you can start documenting your REST API. To be able to follow this tutorial you will need to have your REST API Spring Boot project created. If you do not have one, here is…

Read More How to Add Swagger to a Spring Boot REST API Project

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

Read More Infinite Recursion in Objects with Bidirectional Relationships

In this short tutorial, you will learn how to rollback a database change using @Transactional annotation in your RESTful Web Service built with Spring MVC and JPA. Rollback with @Transactional Annotation Sometimes if an error takes place in our RESTful Web Service we want to rollback the changes made. For changes to be rolled back…

Read More Rollback Using @Transactional in Spring with JPA

In this short Spring Boot tutorial, I am going to share with you how to make Spring Boot app show Hibernate SQL Queries. Enable Hibernate SQL Queries Logging To show hibernate SQL queries in Spring Boot log file you will need to update the application.properties file with the following details: logging.level.org.hibernate.SQL=debug Show SQL Values Additionally,…

Read More Show Hibernate SQL Query in Spring Boot

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, you will learn how to validate the request body of an HTTP Post request sent to a RESTful Web Service endpoint build with Spring Boot and Spring MVC. Request Body JSON Let’s say you have a RESTful Web Service endpoint which accepts HTTP post request with the following JSON payload: { “firstName”:…

Read More Validate Request Body in RESTful Web Service

In this Spring MVC tutorial, you will learn how to make a method in your Rest Controller return a custom or a specific HTTP Status code. To return a specific HTTP Status code in a Spring MVC RESTful Web Service application, you can use the ResponseEntity class. ResponseEntity with HTTP Status Code Let’s assume we…

Read More Return Custom Status Code from Rest Controller

In this JUnit 5 and Rest Assured tutorial, I am going to share with you how to add JUnit 5 and Rest Assured support to your Spring Boot project. It will be more than that actually. This tutorial will cover: Add JUnit 5 and Rest Assured to Spring Boot Project, Create a new JUnit 5…

Read More Create a JUnit 5 Test Case with Rest Assured. Video Tutorial.

In this tutorial, I am going to share with you how to add H2 In-memory database support to your Spring Boot project which has Spring Security enabled. And at the end of this tutorial, you will find a video demonstration of how to do it. Once you do the below-described steps, your Spring Boot project…

Read More Add H2 Database to Spring Boot Project with Spring Security