Skip to content

Commit bf1619e

Browse files
committed
Merge pull request #24477 from izeye
* pr/24477: Use BindResult.orElseGet() where beneficial Closes gh-24477
2 parents d1f2aab + 8e69a82 commit bf1619e

File tree

2 files changed

+3
-2
lines changed
  • spring-boot-project

2 files changed

+3
-2
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/AbstractSessionCondition.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeM
5858
return binder.bind("spring.session.store-type", StoreType.class)
5959
.map((t) -> new ConditionOutcome(t == required,
6060
message.found("spring.session.store-type property").items(t)))
61-
.orElse(ConditionOutcome.noMatch(message.didNotFind("spring.session.store-type property").atAll()));
61+
.orElseGet(() -> ConditionOutcome
62+
.noMatch(message.didNotFind("spring.session.store-type property").atAll()));
6263
}
6364
catch (BindException ex) {
6465
return ConditionOutcome.noMatch(message.found("invalid spring.session.store-type property").atAll());

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/Profiles.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ private String[] get(Environment environment, Binder binder, Supplier<String[]>
9797
if (hasExplicit(supplier, propertyValue, unset)) {
9898
return supplier.get();
9999
}
100-
return binder.bind(propertyName, String[].class).orElse(StringUtils.toStringArray(unset));
100+
return binder.bind(propertyName, String[].class).orElseGet(() -> StringUtils.toStringArray(unset));
101101
}
102102

103103
private boolean hasExplicit(Supplier<String[]> supplier, String propertyValue, Set<String> unset) {

0 commit comments

Comments
 (0)