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
35
votes
8 answers

Spring Webflux + JPA: Reactive Repositories are not supported by JPA

I am getting error when I start my app JPA: Reactive Repositories are not supported by JPA. My Pom has below dependencies and i am using Spring Boot 2.0.5 org.springframework.boot
user10400282
  • 606
  • 1
  • 6
  • 11
35
votes
2 answers

Spring WebFlux (Flux): how to publish dynamically

I am new to Reactive programming and Spring WebFlux. I want to make my App 1 publish Server Sent event through Flux and my App 2 listen on it continuously. I want Flux publish on-demand (e.g. when something happens). All the example I found is to…
John Zhang
  • 1,043
  • 2
  • 13
  • 22
34
votes
4 answers

Spring WebClient: How to stream large byte[] to file?

It seems like it the Spring RestTemplate isn't able to stream a response directly to file without buffering it all in memory. What is the proper to achieve this using the newer Spring 5 WebClient? WebClient client =…
Dave L.
  • 9,595
  • 7
  • 43
  • 69
32
votes
2 answers

Is it possible to start Mono's in parallel and aggregate the result

I know it is possible to chain Mono's, for ex,... Mono resultAMono = loadA(); Mono resultBMono = resultA.flatMap(resultA -> loadB()); This will chain and resultBMono will run when resultAMono returns.... So my question is, is it…
posthumecaver
  • 1,584
  • 4
  • 16
  • 29
32
votes
2 answers

Reactive Spring does not support HttpServletRequest as parameter in REST endpoint?

I created a RestController which look like this : @RestController public class GreetingController { @RequestMapping(value = "/greetings", method = RequestMethod.GET) public Mono greeting(HttpServletRequest request) { …
Dexter
  • 1,710
  • 2
  • 17
  • 34
31
votes
8 answers

Enable CORS in Spring 5 Webflux?

How to enable CORS in a Spring 5 Webflux Project? I cannot find any proper documentation.
Dachstein
  • 3,994
  • 6
  • 34
  • 61
31
votes
10 answers

How to set a timeout in Spring 5 WebFlux WebClient

I'm trying to set timeout on my WebClient, here is the current code : SslContext sslContext = SslContextBuilder.forClient().trustManager(InsecureTrustManagerFactory.INSTANCE).build(); ClientHttpConnector httpConnector = new…
Seb
  • 3,602
  • 8
  • 36
  • 52
30
votes
2 answers

How to prevent embedded netty server from starting with spring-boot-starter-webflux?

I want to establish a communication between a client and server application using Springs new reactive webflux extension. For dependency management I use gradle. My build.gradle file on the server, as well as on the client side basically…
Frank Kaiser
  • 461
  • 1
  • 5
  • 6
29
votes
7 answers

Suddenly Springfox Swagger 3.0 is not working with spring webflux

Application was working with Springfox Swagger 3.0 few days back. Suddenly it is stopped working. The Jar file which was created before a week is still working but now when we try to build a new Jar file, which is not working, even without any…
29
votes
2 answers

How to post request with spring boot web-client for Form data for content type application/x-www-form-urlencoded

How To use spring boot webclient for posting request with content type application/x-www-form-urlencoded sample curl request with content type `application/x-www-form-urlencoded' --header 'Content-Type: application/x-www-form-urlencoded'…
Niraj Sonawane
  • 10,225
  • 10
  • 75
  • 104
29
votes
4 answers

Spring webflux custom authentication for API

I am creating an API for an Angular 5 application. I would like to use JWT for authentication. I would like to use the features that are provided by spring security so I can easily work with roles. I managed to disable basic authentication. But when…
Jan Wytze
  • 3,307
  • 5
  • 31
  • 51
28
votes
3 answers

How to send request body in spring-boot web client?

I'm facing some problem while sending request body in spring boot web client. Trying to send body like below: val body = "{\n" + "\"email\":\"test@mail.com\",\n" + "\"id\":1\n" + "}" val response =…
Avv
  • 555
  • 1
  • 10
  • 18
28
votes
12 answers

Context Path with Webflux

I've been trying to find a way to set the context path for a webflux application. I know I can configure it using server.servlet.context-path if I deploy a servlet, but I would like to achieve it with webflux, without having to explicitly add the…
Marcus Lindwall
  • 305
  • 1
  • 4
  • 6
28
votes
3 answers

Spring Webflux and @Cacheable - proper way of caching result of Mono / Flux type

I'm learning Spring WebFlux and during writing a sample application I found a concern related to Reactive types (Mono/Flux) combined with Spring Cache. Consider the following code-snippet (in Kotlin): @Repository interface TaskRepository :…
Tomek Zaremba
  • 353
  • 1
  • 4
  • 7
27
votes
7 answers

spring webclient: retry with backoff on specific error

i'd like to retry the request 3 times after waiting 10sec when response is 5xx. but i don't see a method that I can use. On object WebClient.builder() .baseUrl("...").build().post() .retrieve().bodyToMono(...) i can…
piotrek
  • 13,982
  • 13
  • 79
  • 165