Spring Webflux JAXB

In this technical post we will take a look at how to produce XML using JAXB Jakarta EE implementation. Java Architecture for XML Binding (JAXB) provides an API and tools that automate the mapping between XML documents and Java objects. 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 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 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]

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 Client

We covered the reactive web server in the previous Spring Boot Server; this time, we will see the client side. Let’s start creating a new project with Webflux and Lombok as dependencies: spring init --dependencies=webflux,lombok --build=gradle --type=gradle-project --language=java client Here is the complete build.gradle file generated: plugins { id 'java' id 'org.springframework.boot' version '3.0.6' id 'io.spring.dependency-management' version '1.1.0' } group = 'com.jos.dem.webflux' version = '0.0.1-SNAPSHOT' sourceCompatibility = 17 configurations { compileOnly { extendsFrom annotationProcessor } } repositories { mavenCentral() } dependencies { implementation('org. [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]