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]
Spring Webflux with Thymeleaf
If you need to render HTML for web and stand alone applications and want to have reactive Spring Webflux as backend, this technical post is for you, because this time we will go through the process to create a basic project in Spring Webflux with Thymeleaf. 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
[Read More]
Spring Webflux Security Database
This post walks you through the process of creating a simple registration and login example with Spring WebFlux Security using MongoDB database. Please read this previous Spring Webflix Security before conitnue with this information. Let’s add MongoDB and Lombok dependencies to the build.gradle file
implementation('org.springframework.boot:spring-boot-starter-data-mongodb-reactive') compileOnly('org.projectlombok:lombok') annotationProcessor('org.projectlombok:lombok') Lombok is a great tool to avoid boilerplate code, for knowing more please go here. Next step, we need to change Spring security Java config class in order to add userDetailsService, so that we can implement database access functionality.
[Read More]