Content negotiation with Spring Boot

In this post we will see how to implement content negotiation in a Spring Boot application. Introduction You may have written RESTful API endpoints where the client sends JSON request and the server sends back a JSON response. However, What would you do if the client can only understand XML? Obviously, You need to write extra logic for XML representation of…

RESTful JPA Repositories with Spring Boot

In this post we will see how to create restful endpoints from JPA Repositories in a Spring Boot application. Introduction In the HATEOAS implementation tutorial, we pretty much save and retrieve data from the database. But there is too much boilerplate code for just managing the data(Controller methods). In situations like these, Spring Data REST comes…

HTTP Error codes based on Exception in Spring Boot

In our previous installment, We have made sure our application follows a hypermedia format called HAL. However, At most of the controller methods, we have been throwing RuntimeException. These by design would cause 500 Error codes. But REST principles dictate that proper message or indication must be given back to the client when possible. For example,…

Spring Boot HATEOAS for RESTFul Web Services

In this article, We will learn how to implement hateoas in a Spring boot restful web application. Introduction to HATEOAS Hypermedia is the most important aspect of RESTful services. To explain in short Hypermedia is a format where the response for one resource contains links to other resources that are related. Any system that uses…

RESTFul Web Services with Spring Boot

To understand RESTful API or RESTful web services, You first need to understand what an API is. API(Application Programming Interface) is a software/application/library/mechanism that helps one program to communicate with another. The most widely used API types are web-APIs or web services. In this type, a client sends an HTTP request, and the server sends…