diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/AbstractSessionCondition.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/AbstractSessionCondition.java index ac072ced3a..52cc494519 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/AbstractSessionCondition.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/AbstractSessionCondition.java @@ -58,7 +58,8 @@ abstract class AbstractSessionCondition extends SpringBootCondition { return binder.bind("spring.session.store-type", StoreType.class) .map((t) -> new ConditionOutcome(t == required, message.found("spring.session.store-type property").items(t))) - .orElse(ConditionOutcome.noMatch(message.didNotFind("spring.session.store-type property").atAll())); + .orElseGet(() -> ConditionOutcome + .noMatch(message.didNotFind("spring.session.store-type property").atAll())); } catch (BindException ex) { return ConditionOutcome.noMatch(message.found("invalid spring.session.store-type property").atAll()); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/Profiles.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/Profiles.java index 496d385df5..c12088ccd9 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/Profiles.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/Profiles.java @@ -97,7 +97,7 @@ public class Profiles implements Iterable { if (hasExplicit(supplier, propertyValue, unset)) { return supplier.get(); } - return binder.bind(propertyName, String[].class).orElse(StringUtils.toStringArray(unset)); + return binder.bind(propertyName, String[].class).orElseGet(() -> StringUtils.toStringArray(unset)); } private boolean hasExplicit(Supplier supplier, String propertyValue, Set unset) {