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

Spring WebFlux Validate OpenAPI Spec Against request

I am trying to validate if OpenAPI specification matches the implementation in Spring Boot Reactive Microservice (WebClient). I bumped into this library swagger-request-validator, however, it does not have any implementation for the WebClient (the…
Abhi Nandan
  • 195
  • 3
  • 11
2
votes
1 answer

Spock -Unit Test:How to write spock unit test for @around annotation which takes Mono

Hi I am using following code to print logs using aop in my webflux app,I have trouble writing unit/integration tests ?can we verify log interactions here?Any help would be appreciated @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD)…
Rocky4Ever
  • 828
  • 3
  • 12
  • 35
2
votes
0 answers

How to guard/lock entites in reactive pipelines between each subscription

How do I lock an entity in a Reactive context between each subscription? I have an endpoint to cancel an order. In the flow, I call some other services to cancel promotion and so on, and at last, I will mark Order in cancelled status and persist…
2
votes
0 answers

How to load balance channel in Spring Webflux / RSocket

Assume we have service A and service B. Service A need to send infinite amount of data to service B. In spring webflux or rsocket, we could do it by making service A send flux and receive flux as well. The problem lies when we have 1 service A and…
Riko Nagatama
  • 388
  • 1
  • 3
  • 15
2
votes
0 answers

Why Swagger UI sends OPTIONS request method instead of correct one, once i access to it through spring Gateway?

I'm implementing open API 3.0 (swagger) in a webflux project. So i have a miscroservice (port 8080) made in spring webflux where I've added open API 3.0. I can access to it through http://localhost:8080/client-service/swagger/swagger-ui.html and…
2
votes
0 answers

Why am I receiving "No mapping for GET /css/main.css" in Java Spring?

I've been stuck on this for a week or two now. For some reason no static resources will load. I chased down the "mime type" issue and discovered that's because it can't access/detect/something the static resources. Any help would be greatly…
2
votes
2 answers

How to read JSON file in reactive way using spring webflux?

I am trying to read file from classpath in a reactive way using spring webflux. I am able to read the file. But I am not able to parse into an Foo object. I am trying the following way, but not sure how to convert to an FOO class. public…
sub
  • 527
  • 1
  • 7
  • 24
2
votes
0 answers

Webflux @RequestBody return 400 BAD_REQUEST

When developing a controller webflux on post request in the parameters of the controller, I pass the request body using the annotation, but in webtestclient method return 400 BAD_REQUEST My DTO: @AllArgsConstructor @Data public class VisitRequest…
Sergey T
  • 33
  • 3
2
votes
0 answers

spring cloud gateway intercept all incoming and outgoing request

It going to be one backend application that expose some REST endpoint and can make call to other backend. This application run in one host. I want on same host run other application - Sidecar. It should: 1)Sidecar should receive all outgoing traffic…
Alstresh
  • 583
  • 2
  • 4
  • 16
2
votes
1 answer

How do I set Content type for Spring Webclient to "application/json-patch+json"

I am trying to make a patch rest request to another API that accepts content type "application/json-patch+json". I am using Spring's webclient but I have not been able to get it to work. I keep getting "415 Unsupported media type" I have tried the…
rand
  • 23
  • 1
  • 1
  • 5
2
votes
0 answers

HttpMessageNotWritableException when returning a Mono for Content-Type 'multipart/form-data in Webflux

I am trying to return a Mono in an API which is used to upload a file. This is the signature of the method. @PatchMapping(value = {"/uploadDoc}, consumes = {MediaType.MULTIPART_FORM_DATA_VALUE} produces =…
2
votes
2 answers

Retrieve generated IDs when doing bulk insert using Spring Data R2DBC

I have a scenario where my table has an autogenerated id column and I need to bulk insert items into db and fetch the generated ids. Is there any way I can achieve that? This is my table: CREATE TABLE test_table ( `id` SERIAL NOT NULL, `name`…
2
votes
2 answers

Spring FileSystemResource NoSuchFileException

I am using FileSystemResource and Spring Webflux to serve files from the hard drive. @GetMapping("/news/file") fun getImage(@RequestParam name: String): FileSystemResource { return FileSystemResource(propsStorage.path + "/" + name) } When the…
Tien Do Nam
  • 3,630
  • 3
  • 15
  • 30
2
votes
0 answers

How to log request body on ResponseStatusException in Web Flux?

I'm trying to implement custom logging for ResponseStatusExceptions (404 errors and similar). Web Flux already has a default handler(WebFluxResponseStatusExceptionHandler) for such exceptions, so I thought to implement my own similar handler and log…
CaptainFreedom
  • 117
  • 4
  • 11
2
votes
1 answer

Trying to Send list of string in post request using webClient in spring

I am trying to send a list of strings using webClient but I am getting an exception. I used Flux.fromIterable(strList) but it merged all the data before sending, because of that instead of a list of strings I received combined single string on…