Update Mono.then(Supplier) deprecated calls
Reactor Core has now deprecated the `Mono.then(Supplier)`. This is now replaced with `Mono.then(Mono.defer(Supplier))`.
This commit is contained in:
parent
09b0364ad7
commit
88f8df4dce
|
@ -90,7 +90,7 @@ public class FluxExchangeResult<T> extends ExchangeResult {
|
||||||
public byte[] getResponseBodyContent() {
|
public byte[] getResponseBodyContent() {
|
||||||
return this.body.ignoreElements()
|
return this.body.ignoreElements()
|
||||||
.timeout(this.timeout, Mono.error(TIMEOUT_ERROR))
|
.timeout(this.timeout, Mono.error(TIMEOUT_ERROR))
|
||||||
.then(() -> Mono.just(super.getResponseBodyContent()))
|
.then(Mono.defer(() -> Mono.just(super.getResponseBodyContent())))
|
||||||
.block();
|
.block();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -83,7 +83,7 @@ public class HttpWebHandlerAdapter extends WebHandlerDecorator implements HttpHa
|
||||||
response.setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR);
|
response.setStatusCode(HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
return Mono.empty();
|
return Mono.empty();
|
||||||
})
|
})
|
||||||
.then(response::setComplete);
|
.then(Mono.defer(response::setComplete));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ServerWebExchange createExchange(ServerHttpRequest request, ServerHttpResponse response) {
|
protected ServerWebExchange createExchange(ServerHttpRequest request, ServerHttpResponse response) {
|
||||||
|
|
|
@ -263,7 +263,7 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
|
||||||
try {
|
try {
|
||||||
// Ensure form data is parsed for "params" conditions...
|
// Ensure form data is parsed for "params" conditions...
|
||||||
return exchange.getRequestParams()
|
return exchange.getRequestParams()
|
||||||
.then(() -> {
|
.then(Mono.defer(() -> {
|
||||||
HandlerMethod handlerMethod = null;
|
HandlerMethod handlerMethod = null;
|
||||||
try {
|
try {
|
||||||
handlerMethod = lookupHandlerMethod(lookupPath, exchange);
|
handlerMethod = lookupHandlerMethod(lookupPath, exchange);
|
||||||
|
@ -283,7 +283,7 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
|
||||||
handlerMethod = handlerMethod.createWithResolvedBean();
|
handlerMethod = handlerMethod.createWithResolvedBean();
|
||||||
}
|
}
|
||||||
return Mono.justOrEmpty(handlerMethod);
|
return Mono.justOrEmpty(handlerMethod);
|
||||||
});
|
}));
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
this.mappingRegistry.releaseReadLock();
|
this.mappingRegistry.releaseReadLock();
|
||||||
|
|
|
@ -186,10 +186,10 @@ public class RequestMappingHandlerAdapter implements HandlerAdapter, Application
|
||||||
|
|
||||||
return this.modelInitializer
|
return this.modelInitializer
|
||||||
.initModel(bindingContext, modelAttributeMethods, exchange)
|
.initModel(bindingContext, modelAttributeMethods, exchange)
|
||||||
.then(() -> this.methodResolver.getRequestMappingMethod(handlerMethod)
|
.then(Mono.defer(() -> this.methodResolver.getRequestMappingMethod(handlerMethod)
|
||||||
.invoke(exchange, bindingContext)
|
.invoke(exchange, bindingContext)
|
||||||
.doOnNext(result -> result.setExceptionHandler(exceptionHandler))
|
.doOnNext(result -> result.setExceptionHandler(exceptionHandler))
|
||||||
.onErrorResume(exceptionHandler));
|
.onErrorResume(exceptionHandler)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Mono<HandlerResult> handleException(Throwable ex, HandlerMethod handlerMethod,
|
private Mono<HandlerResult> handleException(Throwable ex, HandlerMethod handlerMethod,
|
||||||
|
|
Loading…
Reference in New Issue