REST APIs

Spring Boot REST: Consuming and Producing JSON with Jackson

Produce JSON from @RestController methods and consume it with @RequestBody in Spring Boot 4 with Jackson 3. Covers the 400, 415 and 406 errors, Jackson 3 defaults, spring.jackson properties, a JsonMapperBuilderCustomizer, annotations, Gson and tests.

Securing Spring Boot REST API with Basic Auth

Learn to use basic authentication to secure the REST APIs created in a Spring boot application. The secured API will ask for user authentication credentials before giving access to the API response. 1. Maven Dependency The simplest way to add all required jars is to add the latest version of …

Spring Boot HATEOAS Links Example

In this Spring Boot HATEOAS example, we will learn to add HATEOAS (Hypertext as the Engine of Application State) links to resource representations returned from REST APIs in a Spring boot application. 1. What is HATEOAS? HATEOAS is one of the constraints of the REST architectural style first presented by …

Adding Role Based Security with Spring Boot REST APIs

Learn to create JAX-RS 2.0 REST APIs using Spring Boot and Jersey framework, and add role based security using JAX-RS annotations e.g. @PermitAll, @RolesAllowed or @DenyAll. Table of Contents Project Structure Create REST APIs Secure REST APIs with JAX-RS Annotations Write security filter using JAX-RS ContainerRequestFilter Demo Project Structure The …

Create Jersey REST APIs with Spring Boot

Learn to configure and create JAX-RS 2.0 REST APIs using Spring Boot and Jersey framework. This example application uses Jersey’s ServletContainer to deploy the REST APIs.

Difference between SOAP and REST

Although SOAP and REST- both help building applications based on SOA, yet they are pretty much different. Let us learn few differences.

Produce XML Response with Spring WebMVC Controller

In this Spring REST XML example, I am writing hello world example for REST APIs using Spring REST features. In this example, I will be creating two APIs which will return XML representation of resources. 1. Maven Dependencies Let’s start with runtime dependencies which you will need to write these …

Building HATEOAS Links with RESTEasy and JAX-RS

HATEOAS is a constraint on REST that says that a client of a REST application need only know a single fixed URL to access it. Any and all resources should be discoverable dynamically from that URL through hyperlinks included in the representations of returned resources.

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.