Spring Boot Server-sent Events Client

In this technical post we will see how to consume events using Sever-sent events in a Spring Webflux application. Please read this previous Spring Boot Server-sent Events 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-client 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 Webflux Security

Spring Security is a powerful and highly customizable authentication and access-control framework. In this technical post we will go through the process to integrate Spring Security to Spring Reactive Webflux. If you want to know more about how to create a Spring Webflux application please go to my previous post getting started with Spring Webflux here. Let’s begin creating a new Spring Boot project with Webflux, Lombok, Spring Security and Thymeleaf: [Read More]

Spring Webflux Server

This post walks you through the process of creating endpoints using Spring Webflux. Please read this previous Spring Webflux Basics post before continuing with this information. We are going to use @RestController to serve data from our PersonRepository. Let’s consider the following example: package com.jos.dem.webflux.controller; import reactor.core.publisher.Mono; import reactor.core.publisher.Flux; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; import com.jos.dem.webflux.model.Person; import com.jos.dem.webflux.repository.PersonRepository; import lombok.extern.slf4j.Slf4j; @Slf4j @RestController @RequiredArgsConstructor public class PersonController { private final PersonRepository personRepository; @GetMapping("/persons") public Flux<Person> findAll() { log. [Read More]

Getting Started with Spring Webflux

Spring Boot now embraces reactive programming, a non-blocking asynchronous and event-driven application. Spring Framework uses Reactor internally for its own reactive support. The reactor is a Reactive Streams implementation that further extends the primary Publisher contract with Flux and Mono. 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 to my previous post: Spring Boot. [Read More]