diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java
index f9a8af565e6..0b0b89a6a51 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java
@@ -20,7 +20,6 @@ import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
-import java.util.Optional;
import org.springframework.amqp.core.AcknowledgeMode;
import org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.AddressShuffleMode;
@@ -194,7 +193,7 @@ public class RabbitProperties {
if (port != null) {
return port;
}
- return (Optional.ofNullable(getSsl().getEnabled()).orElse(false)) ? DEFAULT_PORT_SECURE : DEFAULT_PORT;
+ return Boolean.TRUE.equals(getSsl().getEnabled()) ? DEFAULT_PORT_SECURE : DEFAULT_PORT;
}
return this.parsedAddresses.get(0).port;
}
@@ -235,7 +234,7 @@ public class RabbitProperties {
private List
parseAddresses(List addresses) {
List parsedAddresses = new ArrayList<>();
for (String address : addresses) {
- parsedAddresses.add(new Address(address, Optional.ofNullable(getSsl().getEnabled()).orElse(false)));
+ parsedAddresses.add(new Address(address, Boolean.TRUE.equals(getSsl().getEnabled())));
}
return parsedAddresses;
}
@@ -475,7 +474,7 @@ public class RabbitProperties {
* @see #getEnabled() ()
*/
public boolean determineEnabled() {
- boolean defaultEnabled = Optional.ofNullable(getEnabled()).orElse(false) || this.bundle != null;
+ boolean defaultEnabled = Boolean.TRUE.equals(getEnabled()) || this.bundle != null;
if (CollectionUtils.isEmpty(RabbitProperties.this.parsedAddresses)) {
return defaultEnabled;
}
diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/structured/StructuredLoggingJsonPropertiesBeanFactoryInitializationAotProcessor.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/structured/StructuredLoggingJsonPropertiesBeanFactoryInitializationAotProcessor.java
index 946fc2c6116..3d23ebc7606 100644
--- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/structured/StructuredLoggingJsonPropertiesBeanFactoryInitializationAotProcessor.java
+++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/structured/StructuredLoggingJsonPropertiesBeanFactoryInitializationAotProcessor.java
@@ -16,7 +16,6 @@
package org.springframework.boot.logging.structured;
-import java.util.Optional;
import java.util.Set;
import org.springframework.aot.generate.GenerationContext;
@@ -58,10 +57,8 @@ class StructuredLoggingJsonPropertiesBeanFactoryInitializationAotProcessor
}
private static String getCustomStackTracePrinter(StructuredLoggingJsonProperties properties) {
- return Optional.ofNullable(properties.stackTrace())
- .filter(StackTrace::hasCustomPrinter)
- .map(StackTrace::printer)
- .orElse(null);
+ StackTrace stackTrace = properties.stackTrace();
+ return (stackTrace != null && stackTrace.hasCustomPrinter()) ? stackTrace.printer() : null;
}
private static final class AotContribution implements BeanFactoryInitializationAotContribution {