Questions tagged [spring-webflux]

Spring Framework 5 includes a new spring-webflux module. The module contains support for reactive HTTP and WebSocket clients as well as for reactive server web applications including REST, HTML browser, and WebSocket style interactions. WebFlux can run on Servlet containers with support for the Servlet 3.1 non-blocking I/O API as well as on other async runtimes such as Netty and Undertow.

Questions tagged spring-webflux should be about applications using the Spring WebFlux framework.

If Spring Boot is involved, please also tag the question with spring-boot. If the question is related to the use of Reactor operators, please tag the question with project-reactor as well.

For Spring WebFlux related documentation, please refer to the:

6050 questions
111
votes
14 answers

DataBufferLimitException: Exceeded limit on max bytes to buffer webflux error

While sending a file I receive an array of bytes. I always have a problem with webflux to receive an array. the error thrown as below : org.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144 …
taveced
  • 1,133
  • 2
  • 7
  • 6
92
votes
18 answers

how to log Spring 5 WebClient call

I'm trying to log a request using Spring 5 WebClient. Do you have any idea how could I achieve that? (I'm using Spring 5 and Spring boot 2) The code looks like this at the moment: try { return webClient.get().uri(url,…
Seb
  • 3,602
  • 8
  • 36
  • 52
77
votes
2 answers

Spring MVC (async) vs Spring WebFlux

I'm trying to understand Spring WebFlux. The things I've found so far are reactive at the core, no Servlet API, no thread per request, HTTP 2, server pushes, application/stream+json. But what is the difference between asynchronous calls in Spring…
Dmitry Senkovich
  • 5,521
  • 8
  • 37
  • 74
69
votes
9 answers

How to customize SpringWebFlux WebClient JSON deserialization?

I'm using a spring-webflux WebClient (build 20170502.221452-172) to access a Web application producing a stream of Entry objects (application/stream+json) like this: final WebClient producerClient =…
Martin
  • 766
  • 1
  • 5
  • 8
64
votes
4 answers

what does Mono.defer() do?

I've come across Mono.defer() in some Spring webflux code I looked up the method in the docs but don't understand the explanation: "Create a Mono provider that will supply a target Mono to subscribe to for each Subscriber downstream" please could I…
James Render
  • 1,490
  • 1
  • 14
  • 26
63
votes
2 answers

Using spring HATEOAS with spring webflux Functional Web Framework (reactor-netty)

Can we use spring HATEOAS on top of RouterFunction ? I imagine that we can specify the resource but what will be the equivalent of the linkto(Controller.class) ? or is there any equivalent to specify the link and use composition of RouterFunction
hba
  • 751
  • 6
  • 4
62
votes
2 answers

Mono switchIfEmpty() is always called

I have two methods. Main method: @PostMapping("/login") public Mono> loginUser(@RequestBody final LoginUser loginUser) { return socialService.verifyAccount(loginUser) .flatMap(socialAccountIsValid ->…
59
votes
3 answers

map vs flatMap in reactor

I've found a lot of answers regarding RxJava, but I want to understand how it works in Reactor. My current understanding is very vague, i tend to think of map as being synchronous and flatMap to be asynchronous but I can't really get my had around…
shredding
  • 5,374
  • 3
  • 46
  • 77
59
votes
17 answers

Spring Boot 2.0 disable default security

I want to use Spring Security for JWT authentication. But it comes with default authentication. I am trying to disable it, but the old approach of doing this - disabling it through application.properties - is deprecated in 2.0. This is what I…
58
votes
1 answer

Backpressure mechanism in Spring Web-Flux

I'm a starter in Spring Web-Flux. I wrote a controller as follows: @RestController public class FirstController { @GetMapping("/first") public Mono getAllTweets() { return Mono.just("I am First Mono") } } I know…
Sam
  • 6,770
  • 7
  • 50
  • 91
58
votes
12 answers

How to log request and response bodies in Spring WebFlux

I want to have centralised logging for requests and responses in my REST API on Spring WebFlux with Kotlin. So far I've tried this approaches @Bean fun apiRouter() = router { (accept(MediaType.APPLICATION_JSON) and "/api").nest { …
Koguro
  • 837
  • 4
  • 9
  • 10
56
votes
1 answer

Threading model of Spring WebFlux and Reactor

Currently experimenting reactive programming with Spring 5.0.0.RC2, Reactor 3.1.0.M2 and Spring Boot 2.0.0.M2. Wondering about the concurrency and threading model used by WebFlux and Reactor to properly code the application and handle the mutable…
53
votes
6 answers

Spring 5 WebClient using ssl

I'm trying to find examples of WebClient use. My goal is to use Spring 5 WebClient to query a REST service using https and self signed certificate Any example?
Seb
  • 3,602
  • 8
  • 36
  • 52
52
votes
1 answer

Can I use SpringMvc and webflux together?

I would like to use 2 approaches(reactive and standard) in one project. I tried to migrate one REST API endpoint to reactive webflux and test performance before migrate rest of them. But it didn't work. I added router and handler for him, but until…
51
votes
3 answers

Java Spring WebFlux vs RxJava

I’m starting to learn reactive programming in Java. The whole reactive paradigm is new to me. In my learning process, i have come across few terms/libraries such as Spring WebFlux, projectreactor, and RxJava. I hope someone can explain what the…
1
2 3
99 100