Polishing

This commit is contained in:
Juergen Hoeller 2023-06-14 22:17:39 +02:00
parent aa2028127f
commit c30f6aa427
3 changed files with 23 additions and 13 deletions

View File

@ -106,8 +106,7 @@ public class InjectionMetadata {
* @since 6.0.10
*/
public Collection<InjectedElement> getInjectedElements(@Nullable PropertyValues pvs) {
return this.injectedElements.stream()
.filter(candidate -> candidate.shouldInject(pvs)).toList();
return this.injectedElements.stream().filter(candidate -> candidate.shouldInject(pvs)).toList();
}
/**
@ -117,7 +116,7 @@ public class InjectionMetadata {
* @since 5.2.4
*/
protected boolean needsRefresh(Class<?> clazz) {
return this.targetClass != clazz;
return (this.targetClass != clazz);
}
public void checkConfigMembers(RootBeanDefinition beanDefinition) {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,7 +27,9 @@ import org.springframework.lang.Nullable;
/**
* Context that holds information for metadata collection regarding
* {@link ServerHttpObservationDocumentation#HTTP_REACTIVE_SERVER_REQUESTS reactive HTTP requests} observations.
* {@link ServerHttpObservationDocumentation#HTTP_REACTIVE_SERVER_REQUESTS reactive HTTP requests}
* observations.
*
* <p>This context also extends {@link RequestReplyReceiverContext} for propagating
* tracing information during HTTP request processing.
*
@ -43,13 +45,23 @@ public class ServerRequestObservationContext extends RequestReplyReceiverContext
private boolean connectionAborted;
public ServerRequestObservationContext(ServerHttpRequest request, ServerHttpResponse response, Map<String, Object> attributes) {
/**
* Create a new {@code ServerRequestObservationContext} instance.
* @param request the current request
* @param response the current response
* @param attributes the current attributes
*/
public ServerRequestObservationContext(
ServerHttpRequest request, ServerHttpResponse response, Map<String, Object> attributes) {
super((req, key) -> req.getHeaders().getFirst(key));
setCarrier(request);
setResponse(response);
this.attributes = Collections.unmodifiableMap(attributes);
}
/**
* Return an immutable map of the current request attributes.
*/
@ -78,8 +90,8 @@ public class ServerRequestObservationContext extends RequestReplyReceiverContext
}
/**
* Whether the current connection was aborted by the client, resulting
* in a {@link reactor.core.publisher.SignalType#CANCEL cancel signal} on the reactive chain,
* Whether the current connection was aborted by the client, resulting in a
* {@link reactor.core.publisher.SignalType#CANCEL cancel signal} on the reactive chain,
* or an {@code AbortedException} when reading the request.
* @return if the connection has been aborted
*/
@ -88,8 +100,8 @@ public class ServerRequestObservationContext extends RequestReplyReceiverContext
}
/**
* Set whether the current connection was aborted by the client, resulting
* in a {@link reactor.core.publisher.SignalType#CANCEL cancel signal} on the reactive chain,
* Set whether the current connection was aborted by the client, resulting in a
* {@link reactor.core.publisher.SignalType#CANCEL cancel signal} on the reactive chain,
* or an {@code AbortedException} when reading the request.
* @param connectionAborted if the connection has been aborted
*/

View File

@ -148,11 +148,10 @@ public interface ServerWebExchange {
*/
default Mono<Void> cleanupMultipart() {
return getMultipartData()
.onErrorResume(t -> Mono.empty()) // ignore errors reading multipart data
.onErrorResume(t -> Mono.empty()) // ignore errors reading multipart data
.flatMapIterable(Map::values)
.flatMapIterable(Function.identity())
.flatMap(part -> part.delete()
.onErrorResume(ex -> Mono.empty()))
.flatMap(part -> part.delete().onErrorResume(ex -> Mono.empty()))
.then();
}