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
2
votes
0 answers

Is there a way to modify the default coroutine context created by Spring?

Using Spring WebFlux and Kotlin Coroutines, methods in controllers are usually (if they invoke other suspending functions) marked with the suspend modifier. That means that Spring implicitly creates coroutines to call them, and it does that with…
WildWind03
  • 301
  • 3
  • 14
2
votes
1 answer

Unable to read classpath resource file in non-blocking way inside docker container

I am trying to load a JSON file sample.json from src/main/resources directory. I have to map that json to a Java Object. And my application is reactive, I am using Spring webflux. I have followed Simon's Blog to come up with this: SimpleModule…
2
votes
2 answers

Zoned time gets converted to UTC in Spring Integration test

I'm trying to verify that my reactive rest controller transfers the correct data. This data contains a ZonedDateTime field I need to retain. However, when querying the rest controller with a WebTestClient, my verification fails because the received…
daniu
  • 14,137
  • 4
  • 32
  • 53
2
votes
0 answers

SecurityContext is always null in Spring WebFlux

I configured Spring Webflux with JWT. Created custom ServerSecurityContextRepository and added it into SecurityWebFilterChain. But when I get SecurityContext while incoming requests, Security context returns always null. The following codes are my…
2
votes
1 answer

@ConnectMapping not getting triggered even after sending SETUP frame from rsocket js client

I have been running a sample RSocket project from (https://dzone.com/articles/rsocket-with-spring-boot-amp-js-zero-to-hero) where I was trying to store requestor Object per client Id. Rsocket JS Client : client = new RSocketClient({ …
2
votes
0 answers

retryWhen used with flatMap throws exception

I wanted to retry in case of any exception from the service. But when using retryWhen am getting exception java.lang.IllegalStateException: UnicastProcessor allows only a single Subscriber. Without retry, its working fine Flux.window(10) …
2
votes
0 answers

performance issue for spring r2dbc

Problem : slowness observed during first 1 sec only and the remaining 59 have a constant response time which 90% better than the max response time. Server Env details: spring boot webflux with r2dbc pool deployed in ECS fargate and connecting to…
2
votes
1 answer

Can I use multiple beforeCommit from multiple webfilters and how to control the order of execution?

I have multiple WebFilters (Webflux Webfilter not the traditional spring MVC filter), each needs to execute some logic before response commit. Can i use multiple beforeCommit ? for example, in filter 1 have have …
user3908406
  • 1,416
  • 1
  • 18
  • 32
2
votes
1 answer

Parallel execution in reactive Flux programming

I am trying to steer away from using blocking thread model and use reactive model for achieving high throughput. The use case I have is this: There is a huge number of incoming messages. For every message I need to do some I/O without blocking that…
falcon
  • 1,332
  • 20
  • 39
2
votes
1 answer

Flux into Mono List Object - project reactor

I'm using project reactor and I've the next issue: I've one method that return Mono that contains a CustomerDto list, each client has attributes, one of theirs attributes is a payment list. But this payment list is null. I've…
2
votes
2 answers

Problem with entity manager in Spring Webflux

In my web client, where I started using Spring WebFlux, I got following exception: reactor.core.Exceptions$ErrorCallbackNotImplemented: javax.persistence.TransactionRequiredException: No EntityManager with actual transaction available for current…
Olek
  • 319
  • 8
  • 24
2
votes
1 answer

WebFlux Swagger (Open API) integraton - Post Request sample

I have integrated Swagger (OpenAPI) with Spring Webflux as mentioned here: https://springdoc.org/#spring-weblfuxwebmvcfn-with-functional-endpoints using RouterOperation. The integration works fine and is accessible at /swagger-ui.html However, for…
Ronnie
  • 302
  • 1
  • 4
  • 16
2
votes
1 answer

What is the difference between @EnableWebSecurity and @EnableWebFluxSecurity?

What is the difference between @EnableWebSecurity and @EnableWebFluxSecurity from the context of security? I am trying to use a Spring Cloud Gateway which supports few reactive Micro-services in the downstream. And few normal web services as well.…
2
votes
1 answer

Java Mono or Flux needed as response for "when" mock with webflux

I am writing some contract tests and I am trying to mock my controller in order to test the wanted method. My method should only return status code 200, so not an object, and I do not know how to write this with Mono or Flux and I get an error…
Maria1995
  • 439
  • 1
  • 5
  • 21
2
votes
1 answer

handle exception with Mono.zip from the response of API Calls Spring web flux

I have a code as follows. I am trying to zip the content. p1Mono and p2Mono are API calls to remote services. They throw various response HTTP response codes. How do I handle those API failures and return the exception with the corresponding codes? …
1 2 3
99
100