Spring Boot Server-sent Events

In this technical post we will see how to integrate Sever-sent events in a Spring Webflux application. Please read this previous Spring Webflux Basics before conitnue with this information. Then, let’s create a new Spring Boot project with Webflux and Lombok as dependencies: spring init --dependencies=webflux,lombok --language=java --build=gradle spring-boot-sse Here is the complete build.gradle file generated: plugins { id 'org.springframework.boot' version '2.3.4.RELEASE' id 'io.spring.dependency-management' version '1.0.10.RELEASE' id 'java' } group = 'com. [Read More]

Spring Boot JsonNode

In computer science, marshalling is the process of transforming the representation of an object to a data format suitable for storage or transmission. In this technical post we will describe how we can marshall and unmarshall using Jackson, JsonNode and Spring Boot. If you want to know more about how to create Spring Webflux please go to my previous post getting started with Spring Webflux here. First let’s create a new Spring Boot Webflux project: [Read More]

Spring Boot Hazelcast

java.util.Map is not thread safe, if you want to use thread safe Map you can use ConcurrentHashMap what if you want to use a map through multiple JVM? then your best option is Hazelcast, besides Hazelcast is Open Source written in Java and Maven friendly. In this technical post we are going to view how we can use Hazelcast among with Spring Boot. If you want to know more about how to create Spring Webflux please go to my previous post getting started with Spring Webflux here. [Read More]

Spring Webflux Testing the Web Layer

In this technical post we will go through the process of testing a reactive web layer using WebTestClient. WebTestClient helps to test Spring WebFlux controllers with auto configuration, if you want to know more about how to create Spring Webflux please go to my previous post getting started with Spring Webflux here. As project target to test we will use Jugoterapia WebFlux which provides healthy juice and smoothie recipes. Please consider this first controller. [Read More]

Spring Webflux Internationalization

In this technical post, we will see how to use different languages (English and Spanish) in your Spring Webflux application along with Thymeleaf template or REST. NOTE: If you need to know what tools you need to have installed in your computer in order to create a Spring Boot basic project, please refer my previous post: Spring Boot. Then, let’s create a new project using this command: spring init --dependencies=webflux --build=gradle --language=java spring-webflux-internationalization This is the build. [Read More]

Spring Webflux Multi-Module

In this technical post, we will review how to build a multi-module project using Gradle and Maven with Spring Boot. NOTE: If you need to know what tools you need to have installed in your computer in order to create a Spring Boot basic project, please refer my previous post: Spring Boot. Let’s start creating a new Spring Boot project with Webflux as a library: spring init --dependencies=webflux,lombok --build=gradle --language=java library Here is the complete build. [Read More]

Webclient Cucumber and Junit 5

This time I will show you how to combine Webflux WebClient along with Cucumber and Junit 5 to consume GitHub API v3 public REST API. First, let’s start creating a new Spring Boot project with Webflux and Lombok as dependencies: spring init --dependencies=webflux,lombok --build=gradle --language=java spring-boot-web-client Here is the complete build.gradle file generated: plugins { id 'org.springframework.boot' version '2.7.0' id 'io.spring.dependency-management' version '1.0.11.RELEASE' id 'java' } group = 'com.jos.dem.webclient' version = '0. [Read More]

Spring Boot WebClient

WebClient is a reactive client that provides an alternative to RestTemplate. It exposes a functional, fluent API and relies on non-blocking I/O which allows it to support high concurrency more efficiently than the RestTemplate. WebClient is a natural fit for streaming scenarios and depends on a lower level HTTP client library to execute requests and that support is pluggable. WebClient uses the same codecs as WebFlux server applications do, and shares a common base package, some common APIs, and infrastructure with the server functional web framework. [Read More]

Spring Webflux Cucumber

BDD (Behavior-driven development) is a technique very similar to implement UAT (User Acceptance Testing) in a software project. Usually is a good idea to use BDD to represent how users can define application behaviour, so in that way you can represent user stories in test scenarios aka. feature testing. This time I am going to show you how integrate Cucumber to a Spring Webflux application, Cucumber is a very powerful testing framework written in the Ruby programming language, which follows the BDD methodology. [Read More]

Spring Boot JMS

Java Message Service is an API for sending and receiving messages. It is an implementation to Producer-Consumer Design Pattern. This technique is usually implemented when you have a time consuming process and you need to avoid that a client is waiting for completing that process. To put this in context let’s think about a scenario where we could use it. The first thing that comes to my mind is an email delivery process. [Read More]