Skip to content

Commit c30f6aa

Browse files
committed
Polishing
1 parent aa20281 commit c30f6aa

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/annotation/InjectionMetadata.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ public Collection<InjectedElement> getInjectedElements() {
106106
* @since 6.0.10
107107
*/
108108
public Collection<InjectedElement> getInjectedElements(@Nullable PropertyValues pvs) {
109-
return this.injectedElements.stream()
110-
.filter(candidate -> candidate.shouldInject(pvs)).toList();
109+
return this.injectedElements.stream().filter(candidate -> candidate.shouldInject(pvs)).toList();
111110
}
112111

113112
/**
@@ -117,7 +116,7 @@ public Collection<InjectedElement> getInjectedElements(@Nullable PropertyValues
117116
* @since 5.2.4
118117
*/
119118
protected boolean needsRefresh(Class<?> clazz) {
120-
return this.targetClass != clazz;
119+
return (this.targetClass != clazz);
121120
}
122121

123122
public void checkConfigMembers(RootBeanDefinition beanDefinition) {

spring-web/src/main/java/org/springframework/http/server/reactive/observation/ServerRequestObservationContext.java

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,7 +27,9 @@
2727

2828
/**
2929
* Context that holds information for metadata collection regarding
30-
* {@link ServerHttpObservationDocumentation#HTTP_REACTIVE_SERVER_REQUESTS reactive HTTP requests} observations.
30+
* {@link ServerHttpObservationDocumentation#HTTP_REACTIVE_SERVER_REQUESTS reactive HTTP requests}
31+
* observations.
32+
*
3133
* <p>This context also extends {@link RequestReplyReceiverContext} for propagating
3234
* tracing information during HTTP request processing.
3335
*
@@ -43,13 +45,23 @@ public class ServerRequestObservationContext extends RequestReplyReceiverContext
4345

4446
private boolean connectionAborted;
4547

46-
public ServerRequestObservationContext(ServerHttpRequest request, ServerHttpResponse response, Map<String, Object> attributes) {
48+
49+
/**
50+
* Create a new {@code ServerRequestObservationContext} instance.
51+
* @param request the current request
52+
* @param response the current response
53+
* @param attributes the current attributes
54+
*/
55+
public ServerRequestObservationContext(
56+
ServerHttpRequest request, ServerHttpResponse response, Map<String, Object> attributes) {
57+
4758
super((req, key) -> req.getHeaders().getFirst(key));
4859
setCarrier(request);
4960
setResponse(response);
5061
this.attributes = Collections.unmodifiableMap(attributes);
5162
}
5263

64+
5365
/**
5466
* Return an immutable map of the current request attributes.
5567
*/
@@ -78,8 +90,8 @@ public void setPathPattern(@Nullable String pathPattern) {
7890
}
7991

8092
/**
81-
* Whether the current connection was aborted by the client, resulting
82-
* in a {@link reactor.core.publisher.SignalType#CANCEL cancel signal} on the reactive chain,
93+
* Whether the current connection was aborted by the client, resulting in a
94+
* {@link reactor.core.publisher.SignalType#CANCEL cancel signal} on the reactive chain,
8395
* or an {@code AbortedException} when reading the request.
8496
* @return if the connection has been aborted
8597
*/
@@ -88,8 +100,8 @@ public boolean isConnectionAborted() {
88100
}
89101

90102
/**
91-
* Set whether the current connection was aborted by the client, resulting
92-
* in a {@link reactor.core.publisher.SignalType#CANCEL cancel signal} on the reactive chain,
103+
* Set whether the current connection was aborted by the client, resulting in a
104+
* {@link reactor.core.publisher.SignalType#CANCEL cancel signal} on the reactive chain,
93105
* or an {@code AbortedException} when reading the request.
94106
* @param connectionAborted if the connection has been aborted
95107
*/

spring-web/src/main/java/org/springframework/web/server/ServerWebExchange.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,10 @@ default <T> T getAttributeOrDefault(String name, T defaultValue) {
148148
*/
149149
default Mono<Void> cleanupMultipart() {
150150
return getMultipartData()
151-
.onErrorResume(t -> Mono.empty()) // ignore errors reading multipart data
151+
.onErrorResume(t -> Mono.empty()) // ignore errors reading multipart data
152152
.flatMapIterable(Map::values)
153153
.flatMapIterable(Function.identity())
154-
.flatMap(part -> part.delete()
155-
.onErrorResume(ex -> Mono.empty()))
154+
.flatMap(part -> part.delete().onErrorResume(ex -> Mono.empty()))
156155
.then();
157156
}
158157

0 commit comments

Comments
 (0)