Skip to content

Commit

Permalink
Minor refactoring in ContextValueMethodArgumentResolver
Browse files Browse the repository at this point in the history
See gh-988
  • Loading branch information
rstoyanchev committed Jun 11, 2024
1 parent 1d97586 commit 22bbc86
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 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.
Expand Down Expand Up @@ -83,13 +83,7 @@ static Object resolveContextValue(
}

if (isMono) {
if (value == null) {
value = Mono.empty();
}
else if (!(value instanceof Mono)) {
value = Mono.just(value);
}
return Mono.just(value);
return Mono.just((value instanceof Mono<?> mono) ? mono : Mono.justOrEmpty(value));
}

if (isOptional) {
Expand Down

0 comments on commit 22bbc86

Please sign in to comment.