Questions tagged [webflux]

101 questions
2
votes
1 answer

What are the differences of Flux, Flux>, ResponseEntity> as return type in Spring WebFlux?

I often see three different response return types: Flux, ResponseEntity>, and Flux> in MVC style controllers using Spring WebFlux. The documentation explains the difference between ResponseEntity> and…
Buck
  • 471
  • 3
  • 9
2
votes
1 answer

Is possible to convert a Flux to Mono

I playing around with r2dc for spring boot java application. I was thinking if possible to convert a Flux to Mono for certain calculation. Pseudo example: static PseudoMagic calculate(List foos) { return…
Dasma
  • 1,023
  • 13
  • 34
2
votes
0 answers

Spring Boot + webflux: Could not resolve view with name

I need to response with image jpeg data @Controller @RequestMapping("/resource") class ResourceController() { @GetMapping("/thumbnail/{userFileId}/{group}/{index}", produces = [MediaType.IMAGE_JPEG_VALUE]) suspend fun getThumbnail( …
Hett
  • 3,484
  • 2
  • 34
  • 51
2
votes
1 answer

put a "Data class" into Kafka using io.projectreactor.kafka:reactor-kafka jsonserializer problem

I could not find any json serializer in reactor-kafka, so i use org.springframework.kafka.support.serializer.JsonSerializer I have also try to use com.fasterxml.jackson.databind.annotation.JsonSerialize instead but it didn't work. can any body help…
2
votes
0 answers

Allowing a Slash Character In Spring WebFlux Get Requests

I have a spring WebFlux project and it turns out that I need to allow for a Slash in query parameters for a couple API calls. In Spring MVC you would use the HttpServletRequest to handle that use case like in this example: @PathVariable in…
SoftwareSavant
  • 9,467
  • 27
  • 121
  • 195
2
votes
1 answer

Spring security authorizeExchange and authorizeRequests difference

when use spring security web, we can use the antMathcers http.authorizeRequests() .antMatchers("/admin/**") when use webflux, we use http.authorizeExchange(exchanges-> exchanges …
Jimmy Guo
  • 1,288
  • 1
  • 9
  • 24
2
votes
3 answers

Project reactor, Convert Flux into Map>

I have a list of Data object public class Data{ private String id; private String sharedId; } How to convert this list into Map>, collecting the data object sharing the same sharedId together I have tried to use this line…
Melad Basilius
  • 3,847
  • 10
  • 44
  • 81
2
votes
1 answer

Error in Controller layer error handling in spring webflux

So I want to achieve the functionality of saving an user for that first i check whether user is present if present throw an exception else save the user But when I throw an exception from service layer .flatMap(user -> Mono.error(new…
2
votes
1 answer

Example of error handling calling Restful services with WebFlux

I'm looking for a simple example of error handling with WebFlux. I've read lots of stuff online, but can't find something that fits what I want. I'm running with Spring Boot 2.45 I am calling services like this: Mono mono =…
2
votes
1 answer

Transforming a Flux into a Tree with Spring Webflux

We recently started to refactor our Spring WebMVC code to WebFlux, replacing RestTemplate's by WebClient. From an external web server, we receive a flat list of objects (Product), each of which contains a reference to a parent object: …
Jay
  • 33
  • 2
  • 8
2
votes
2 answers

Set coroutine context from spring webflux WebFilter

How to set coroutine context from spring webflux WebFilter? Is it possible? I know I can use reactor context, but I'm not able to set coroutine context. MORE DETAILS: I want to use MDCContext to propagate MDC to slf4j. For example, I would like to…
Eugene Nacu
  • 1,613
  • 2
  • 14
  • 22
1
vote
1 answer

Spring: No converter for [class java.util.ArrayList] with preset Content-Type 'null'

I keep getting this error even if the obvious possible causes seems to be taken care of (missing public getters on Survey class, missing jackson from dependency...) Servlet.service() for servlet [dispatcherServlet] in context with path [] threw…
nicari
  • 25
  • 1
  • 2
  • 7
1
vote
2 answers

Handling checked exception in Mono flow

Not sure how to handle checked exception in the Mono flow. return Mono.when(monoPubs) .zipWhen((monos) -> repository.findById(...)) .map((tuple) -> tuple.getT2()) .zipWhen((org) -> createMap(org)) …
user1578872
  • 7,808
  • 29
  • 108
  • 206
1
vote
1 answer

how to merge the response of webClient call after calling 5 times and save the complete response in DB

i have scenario like: i have to check the table if entry is available in DB then if available i need to call the same external api n times using webclient, collect all the response and save them in DB. if entry is not available in DB call the old…
1
vote
0 answers

Webflux collect errors from list?

I have a List myList. The code looks like: Flux.fromIterable(myList) .distinct() .flatMap(id -> mysvc.getItem(id) .switchIfEmpty(Mono.error(...)))) Note that mysvc is returning a Mono and the .switchIfEmpty is attached to…
SledgeHammer
  • 7,338
  • 6
  • 41
  • 86