Skip to content

Commit 22bbc86

Browse files
committed
Minor refactoring in ContextValueMethodArgumentResolver
See gh-988
1 parent 1d97586 commit 22bbc86

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

spring-graphql/src/main/java/org/springframework/graphql/data/method/annotation/support/ContextValueMethodArgumentResolver.java

+2-8
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-2024 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.
@@ -83,13 +83,7 @@ static Object resolveContextValue(
8383
}
8484

8585
if (isMono) {
86-
if (value == null) {
87-
value = Mono.empty();
88-
}
89-
else if (!(value instanceof Mono)) {
90-
value = Mono.just(value);
91-
}
92-
return Mono.just(value);
86+
return Mono.just((value instanceof Mono<?> mono) ? mono : Mono.justOrEmpty(value));
9387
}
9488

9589
if (isOptional) {

0 commit comments

Comments
 (0)