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 2d22769c427..17ccdf9e8a5 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 @@ -420,7 +420,8 @@ public class ConfigurationPropertiesBindingPostProcessor implements BeanPostProc if (AnnotatedElementUtils.hasAnnotation(type, Validated.class)) { return true; } - if (type.getPackage().getName().startsWith("org.springframework.boot")) { + if (type.getPackage() != null && + type.getPackage().getName().startsWith("org.springframework.boot")) { return false; } if (getConstraintsForClass(type).isBeanConstrained()) {