diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/BoundConfigurationProperties.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/BoundConfigurationProperties.java index a41f8e43d8..9e88322cfe 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/BoundConfigurationProperties.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/BoundConfigurationProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 the original author or authors. + * Copyright 2012-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. @@ -72,10 +72,8 @@ public class BoundConfigurationProperties { * @return a {@link BoundConfigurationProperties} or {@code null} */ public static BoundConfigurationProperties get(ApplicationContext context) { - if (!context.containsBeanDefinition(BEAN_NAME)) { - return null; - } - return context.getBean(BEAN_NAME, BoundConfigurationProperties.class); + return (!context.containsBeanDefinition(BEAN_NAME)) ? null + : context.getBean(BEAN_NAME, BoundConfigurationProperties.class); } static void register(BeanDefinitionRegistry registry) {