diff --git a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java index f48c24fefb..2fc96302dd 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java @@ -298,10 +298,7 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc factory.bindPropertiesToTarget(); } catch (Exception ex) { - String targetClass = "[unknown]"; - if (target != null) { - ClassUtils.getShortName(target.getClass()); - } + String targetClass = ClassUtils.getShortName(target.getClass()); throw new BeanCreationException(beanName, "Could not bind properties to " + targetClass + " (" + getAnnotationDetails(annotation) + ")", ex); }