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
27
votes
4 answers

Spring WebFlux throws 'producer' type is unknow when I return value in the response body

I'm using Spring Boot with Kotlin, and now trying to get status value from a GET restful service by passing a handler for a reactive service. I can see that the handler I'm passing is in the request, but whenever I'm building the body, I get this…
hasan.alkhatib
  • 1,509
  • 3
  • 14
  • 28
27
votes
2 answers

what is the difference between ResponseEntity and Mono as a return type of a rest controller

In Spring Webflux, what's the difference between ResponseEntity versus Mono as a return type of a rest controller? When is the most appropriate to what? Following up on this question, let's say I need to return a list, or let's…
Chaofan Zhang
  • 371
  • 3
  • 4
27
votes
3 answers

How can I support an HTTP Proxy using Spring 5 WebClient?

I am using Spring 5 WebClient. I want to know if it is possible to configure it to use an HTTP Proxy, or if there is a way of changing it's default configuration to do so.
Taylor Gautier
  • 4,916
  • 7
  • 30
  • 24
26
votes
1 answer

What's the difference between "text/event-stream" and "application/stream+json"

@GetMapping(path = "/cars", produces = "text/event-stream") public Flux getCarStream() { System.out.println("application/stream+json"); return this.repository.findCarsBy().log(); } What's the difference between the above code and the…
Ekaterina
  • 1,642
  • 3
  • 19
  • 36
26
votes
2 answers

Spring Webflux 415 with MultipartFile

I am currently trying to upload a file from an Angular 4 front-end to a Spring Webflux controller. The controller is able to read the @RequestPart value but throws a 415 UnsupportedMediaTypeStatusException. UploadController @PostMapping( consumes =…
mep
  • 431
  • 1
  • 4
  • 15
25
votes
3 answers

Zip Three Different Mono of Different Type

I have started a new project using Spring Webflux and I am fairly new to this reactive coding paradigm. So apologies in advance for questioning like newbies. My controller method returns the response as Mono> and I have three…
bivrantoshakil
  • 421
  • 1
  • 5
  • 10
25
votes
5 answers

How to correctly use slf4j MDC in spring-webflux WebFilter

I referenced with the blog post Contextual Logging with Reactor Context and MDC but I don't know how to access reactor context in WebFilter. @Component public class RequestIdFilter implements WebFilter { @Override public Mono
bitdancer
  • 1,215
  • 2
  • 19
  • 34
25
votes
2 answers

Reactive Spring WebClient - Making a SOAP call

I am looking to make a SOAP call from spring reactive webclient. I couldn't find any documentation for it. Wondering what would the approach. Right now I am thinking Construct the SOAP message using JAXB on a separate thread pool Make the call by…
Faisal Masood
  • 271
  • 1
  • 3
  • 7
25
votes
4 answers

Get API response error message using Web Client Mono in Spring Boot

I am using webflux Mono (in Spring boot 5) to consume an external API. I am able to get data well when the API response status code is 200, but when the API returns an error I am not able to retrieve the error message from the API. Spring webclient…
Mohale
  • 2,040
  • 3
  • 17
  • 18
25
votes
5 answers

Spring Webflux, How to forward to index.html to serve static content

spring-boot-starter-webflux (Spring Boot v2.0.0.M2) is already configured like in a spring-boot-starter-web to serve static content in the static folder in resources. But it doesn't forward to index.html. In Spring MVC it is possible to configure…
Ihor Rybak
  • 3,091
  • 2
  • 25
  • 32
25
votes
5 answers

How to serve static content using Webflux?

I am learning webflux and I would like to know how to serve static content on a MicroService using webflux but I didn´t find information to do it.
jabrena
  • 1,166
  • 3
  • 11
  • 25
25
votes
6 answers

Configured ObjectMapper not used in spring-boot-webflux

I have mixins configured in my objectmapperbuilder config, using the regular spring web controller, the data outputted according to the mixins. However using webflux, a controller with a method returning a Flow or Mono have the data serialized like…
user1568967
  • 1,816
  • 2
  • 16
  • 18
24
votes
3 answers

Does the use of Spring Webflux's WebClient in a blocking application design cause a larger use of resources than RestTemplate

I am working on several spring-boot applications which have the traditional pattern of thread-per-request. We are using Spring-boot-webflux to acquire WebClient to perform our RESTful integration between the applications. Hence our application…
24
votes
3 answers

How to do sequence of operations and ensure one operation is complete before next one in Spring Reactor web app?

I have Spring Boot 2 web app in which I need to identify site visitor by cookie and gather page view stats. So I need to intercept every web request. The code I had to write is more complex than call back hell (the very problem Spring reactor was…
ace
  • 11,526
  • 39
  • 113
  • 193
23
votes
3 answers

Method call after returning Mono

I want to call the method when previous returned Mono: @Override public Mono sendEmail(EmailDto emailDto) { return mailReactiveClient.sendEmail(message -> createMessage(emailDto, emailDto.getBody(), message)) …
kostepanych
  • 2,229
  • 9
  • 32
  • 47