Posts

Showing posts with the label WebFlux

Building Reactive REST CRUD APIs Using Spring WebFlux & R2DBC

Image
Hello everyone, Today we will learn how to use Spring Boot, Spring WebFlux, and R2DBC  to create a reactive web service that interacts with H2 in-memory database. Reactive APIs are non-blocking and tend to be more efficient because they’re not tying up processing while waiting for stuff to happen. Reactive systems adopt asynchronous I/O. Reactive apps allow us to scale better if we are dealing with lots of streaming data.  If we are going to build a reactive app, we need it to be reactive all the way down to your database. Use a blocking JDBC driver with Spring WebFlux, and we will be displeased with its performance. Use a reactive NoSQL database like Cassandra, MongoDB, Couchbase, and Redis – and we will be satisfied with its performance. Spring WebFlux uses a library called Reactor for its reactive support. The  Reactor  is an implementation of the Reactive Streams specification. The Reactor Provides two main types called  Flux  and  Mono . Both of these types implement the Publisher

Kotlin + Spring Webflux File Download - REST API Example

Image
In this article, We will learn how to download files in a RESTful Kotlin + Spring WebFlux application. More Spring WebFlux practice: Kotlin + Spring Webflux File Upload (Single/Multiple)- REST API Example Spring Webflux File Upload (Single/Multiple)- REST API Example Spring Webflux File Download - REST API Example Reactive Rest CRUD APIs using Spring Boot, WebFlux, and Reactive Mongo Technologies Used: Kotlin Spring Boot 2.5.4 Spring Webflux Java 11 Gradle Project Structure: Project Dependency Management(build.gradle.kts) Spring boot dependencies, no need for an extra library for file upload. import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { id( "org.springframework.boot" ) version "2.5.4" id( "io.spring.dependency-management" ) version "1.0.11.RELEASE" kotlin( "jvm" ) version "1.5.21" kotlin( "plugin.spring" ) version "1.5.21" } group = "com.knf.dev.demo" version = &qu

Spring Webflux File Download Example

Image
Hello everyone, Here we will show you an example of how to download files in a Spring WebFlux application. More related topics: Spring Webflux File Upload (Single/Multiple)- REST API Example Kotlin + Spring Webflux File Upload (Single/Multiple)- REST API Example Kotlin + Spring Webflux File Download - REST API Example Reactive Rest CRUD APIs using Spring Boot, WebFlux, and Reactive Mongo Technologies Used: Spring Boot 2.5.4 Spring Webflux 2.5.4 Java 11 Maven 3 Project Structure: Project Dependency Management Spring boot dependencies, no need for the extra library for file upload. <? xml version ="1.0" encoding ="UTF-8" ?> < project xmlns ="http://maven.apache.org/POM/4.0.0" xmlns: xsi ="http://www.w3.org/2001/XMLSchema-instance" xsi :schemaLocation ="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" > < modelVersion >4.0.0</ modelVersion > < parent > &l

Spring Webflux File Upload - Single&Multiple - REST API Example

Image
This article shows you how to upload Single|Multiple files in the Spring Webflux application.  More Spring WebFlux practice: Spring Webflux File Download - REST API Example Kotlin + Spring Webflux File Download - REST API Example Kotlin + Spring Webflux File Upload (Single/Multiple)- REST API Example Reactive Rest CRUD APIs using Spring Boot, WebFlux, and Reactive Mongo Technologies Used: Spring Boot 2.5.4 Spring Webflux 2.5.4 Java 11 Maven 3 Project Structure: Project Dependency Spring boot dependencies, no need for an extra library for file upload. <?xml version = "1.0" encoding = "UTF-8" ?> <project xmlns = "http://maven.apache.org/POM/4.0.0" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" > <modelVersion> 4.0.0 </modelVersion> <parent> <groupId> org.s