Questions tagged [spring-reactive]
128 questions
2
votes
1 answer
Can we use Spring Webflux with spring data jdbc template? What will be the impact? what to do in such situation where we can not use R2DBC?
I am new to spring web flux and not sure how to integrate it with the existing spring jdbc template which uses blocking persistence driver for the oracle. i.e.. in my situation R2DBC (oracle) is not supported/not available. I must have to use…

irfan bhindawala
- 23
- 4
2
votes
2 answers
Mono flatMap + switchIfEmpty Combo Operator?
Is there an operator that allows to process result/success whether or not Mono is empty. For example:
Mono result = sourceMono.flatMap(n -> process(n)).switchIfEmpty(process(null));
where:
Mono process(Foo in){
Optional foo =…

hmble
- 140
- 2
- 11
2
votes
0 answers
Spring Data Reactive Mongo Template: MongoDB cursor
What is the recommended way to iterate over a large result with reactive mongo template?
I can't find a reactive alternative for the blocking MongoTemplate::stream() operation, which uses MongoDB cursor (and works perfectly well).
When I do the most…

silent-box
- 1,649
- 3
- 21
- 40
2
votes
4 answers
Unable to connect to MongoDB in Spring Boot application
I've just created a very basic Spring Boot project using Spring Tool Suite with mongoDB-reactive dependency and run the app but, I keep getting the following exceptions
2019-11-27 00:31:19.699 INFO 11988 --- [localhost:27017]
…

rakesh mehra
- 618
- 1
- 9
- 21
2
votes
3 answers
How to throw an exception in on error part of reactive Spring WebClient call?
I would like the following method to throw a custom exception if an error occurs:
@Service
public class MyClass {
private final WebClient webClient;
public MatcherClient(@Value("${my.url}") final String myUrl) {
this.webClient =…

Ira Re
- 730
- 3
- 9
- 25
1
vote
0 answers
Get current logged in user in Spring AOP using Spring Webflux
I am using Spring Webflux with Kotlin Coroutine and Spring AOP. I have simple Advice which is like this.
@Around("@annotation(LogAccess)")
public Object logErrorAccess(ProceedingJoinPoint joinPoint) throws Throwable {
MethodSignature…

nicholasnet
- 2,117
- 2
- 24
- 46
1
vote
1 answer
Stream> to Flux in spring reactor
Lets say I have ProductSupplier which allow to get product by id. But it has restrictions and per one request you can load only one product.
public interface ProductSupplier {
public Mono getById(Long productId);
}
Now I'm writing…

Bohdan Petrenko
- 997
- 2
- 17
- 34
1
vote
0 answers
Reactive WebFlux Publish Notifications to specific Subscriber
I want to build an user notification system. The ideia is that if the user is logged the system will subscribe the notification service and as the notifications are generated to that use it must return the number of new notifications.
I'm using Java…

Sérgio Andaluz Ramos
- 103
- 1
- 8
1
vote
1 answer
Spring Reactive Request Context Map Not Found Error
I'm using the ServerWebExchangeContextFilter filter to store the current ServerWebExchange context inside the context map provided by spring.
But when I try to get this saved ServerWebExchange context from a different part of my code (downstream), I…

Siddharth Agrawal
- 187
- 2
- 8
1
vote
0 answers
How to cancel WebClient reactive call before initiating a new one when first one is in waiting to be retried
I’m using WebClient to create a call to send status updates to an endpoint as below:
public Disposable updateStatus(Status status) {
return WebClient.create("http://server:7777")
.post()
.body(status, Status.class)
.exchange()
…

Vahid
- 1,625
- 1
- 18
- 33
1
vote
2 answers
How to consolidate the results of Mono Objects in spring WebFlux?
Please look at the below code from controller(Added comments) which uses RestTemplate:
@GetMapping("/{courseid}")
public Course getCourseDetails(@PathVariable Long courseid) {
// Get Course info (ID, Name, Description) from pre-populated Array…

rakesh mehra
- 618
- 1
- 9
- 21
1
vote
2 answers
Right using of mapping in WebFlux
public Mono getEmail() {
Mono emailService = ReactiveSecurityContextHolder.getContext()
.map(securityContext -> (Principal) securityContext.getAuthentication().getPrincipal())
…

Vladimir Safonov
- 67
- 1
- 9
1
vote
1 answer
Reactive Spring Boot: return evaluates before map finshed
I'm using reactive WebClient to build an API that communicates with 2 other APIs. API2 needs to get Information from API1, and then my service combines and returns both information.
Resource:
@GetMapping("monoMedication/{medID}")
public …

schubbei
- 13
- 5
1
vote
1 answer
Reactive Spring Boot - java.lang.NoSuchFieldError: DEFAULT_SHUTDOWN_QUIET_PERIOD
I'm attempting to migrate an old spring application to springboot 2.3.1 and spring 5.2.7. Goal is to make a reactive application. However I'm stuck on the below. I'm not entirely sure what else I need to upgrade.
This is part of my pom, other…

user3298823
- 302
- 2
- 17
1
vote
1 answer
Check database for access in Spring Gateway Pre filter
I am using Spring Gateway, where I need to check further user access by Request path using DB call. My repository is like this.
public Mono getByUri(String url)
....
This is my current filter where I am using custom…

nicholasnet
- 2,117
- 2
- 24
- 46