{"record":{"id":"6bc7bdbfa830b611","repo":"spring-projects/spring-framework","slug":"invalid-property-propertyname-of-bean-class-6bc7bd","errorCode":null,"errorMessage":"Invalid property '{propertyName}' of bean class [{beanClass.getName()}]: Could not determine property type for auto-growing a default value","messagePattern":"Invalid property '(.+?)' of bean class \\[(.+?)\\]: Could not determine property type for auto-growing a default value","errorType":"exception","errorClass":"NullValueInNestedPathException","httpStatus":null,"severity":"error","filePath":"spring-beans/src/main/java/org/springframework/beans/AbstractNestablePropertyAccessor.java","lineNumber":871,"sourceCode":"\t\t\tif (logger.isTraceEnabled()) {\n\t\t\t\tlogger.trace(\"Using cached nested property accessor for property '\" + canonicalName + \"'\");\n\t\t\t}\n\t\t}\n\t\treturn nestedPa;\n\t}\n\n\tprivate Object setDefaultValue(PropertyTokenHolder tokens) {\n\t\tPropertyValue pv = createDefaultPropertyValue(tokens);\n\t\tsetPropertyValue(tokens, pv);\n\t\tObject defaultValue = getPropertyValue(tokens);\n\t\tAssert.state(defaultValue != null, \"Default value must not be null\");\n\t\treturn defaultValue;\n\t}\n\n\tprivate PropertyValue createDefaultPropertyValue(PropertyTokenHolder tokens) {\n\t\tTypeDescriptor desc = getPropertyTypeDescriptor(tokens.canonicalName);\n\t\tif (desc == null) {\n\t\t\tthrow new NullValueInNestedPathException(getRootClass(), this.nestedPath + tokens.canonicalName,\n\t\t\t\t\t\"Could not determine property type for auto-growing a default value\");\n\t\t}\n\t\tObject defaultValue = newValue(desc.getType(), desc, tokens.canonicalName);\n\t\treturn new PropertyValue(tokens.canonicalName, defaultValue);\n\t}\n\n\tprivate Object newValue(Class<?> type, @Nullable TypeDescriptor desc, String name) {\n\t\ttry {\n\t\t\tif (type.isArray()) {\n\t\t\t\treturn createArray(type);\n\t\t\t}\n\t\t\telse if (Collection.class.isAssignableFrom(type)) {\n\t\t\t\tTypeDescriptor elementDesc = (desc != null ? desc.getElementTypeDescriptor() : null);\n\t\t\t\treturn CollectionFactory.createCollection(type, (elementDesc != null ? elementDesc.getType() : null), 16);\n\t\t\t}\n\t\t\telse if (Map.class.isAssignableFrom(type)) {\n\t\t\t\tTypeDescriptor keyDesc = (desc != null ? desc.getMapKeyTypeDescriptor() : null);\n\t\t\t\treturn CollectionFactory.createMap(type, (keyDesc != null ? keyDesc.getType() : null), 16);","sourceCodeStart":853,"sourceCodeEnd":889,"githubUrl":"https://github.com/spring-projects/spring-framework/blob/69bf83ad716d0cfc4b0520a19b4d8b24c79d1538/spring-beans/src/main/java/org/springframework/beans/AbstractNestablePropertyAccessor.java#L853-L889","documentation":"Thrown as NullValueInNestedPathException by createDefaultPropertyValue at AbstractNestablePropertyAccessor.java:871 when auto-grow is enabled but getPropertyTypeDescriptor() returns null for the property, so Spring cannot determine which class to instantiate as the default value. It is purely an auto-grow configuration/introspection failure, not a null data problem.","triggerScenarios":"setAutoGrowNestedPaths(true) is set, then a nested path is traversed whose target property has no readable/writable accessor and no resolvable TypeDescriptor (e.g. a property that exists only as a Map/Collection index with no generic info, or a synthetic property the BeanWrapper cannot introspect). getPropertyTypeDescriptor returns null and setDefaultValue is invoked.","commonSituations":"Auto-growing into an untyped Map/Object property; binding against a dynamic bean with no proper getters/setters; auto-growing a property whose declaring class has reflection issues (introspection partially failed); misconfigured @ConfigurationProperties with auto-grow on a field Spring cannot introspect.","solutions":["Disable auto-grow for that path or give the property a concrete declared type with proper getter/setter.","Add explicit getter/setter and field type so getPropertyTypeDescriptor resolves to a real class.","Pre-initialize the nested object yourself instead of relying on auto-grow.","Register a custom property editor / ConversionService if the type is non-standard."],"exampleFix":"// before: auto-grow cannot infer type\nprivate Object details;\nwrapper.setAutoGrowNestedPaths(true);\n\n// after: concrete, introspectable type\nprivate Details details = new Details();","handlingStrategy":"validation","validationCode":"// Only enable auto-grow for fully introspectable types\nBeanWrapper w = new BeanWrapperImpl(target);\nif (w.getPropertyTypeDescriptor(\"details\") != null) {\n    w.setAutoGrowNestedPaths(true);\n} else {\n    // initialize manually; do not rely on auto-grow\n    ((MyBean) target).setDetails(new Details());\n}","typeGuard":"static boolean autoGrowSafe(BeanWrapper w, String path) {\n    return w.getPropertyTypeDescriptor(path) != null;\n}","tryCatchPattern":"try {\n    wrapper.setAutoGrowNestedPaths(true);\n    wrapper.getPropertyValue(\"details.x\");\n} catch (NullValueInNestedPathException ex) {\n    if (ex.getMessage().contains(\"Could not determine property type\")) {\n        // not a data problem: introspect the type manually\n        throw new IllegalStateException(\"cannot auto-grow \" + ex.getPropertyName(), ex);\n    }\n    throw ex;\n}","preventionTips":["Ensure auto-grown properties have concrete declared types with getters/setters.","Prefer explicit initialization over auto-grow for non-introspectable types.","Test auto-grow against each nested type in a unit test.","Avoid Object/Map-typed fields where you expect auto-grow to materialize a bean."],"tags":["spring-beans","beanwrapper","auto-grow","introspection","nested-property"],"backgroundTag":null,"analyzedSha":"69bf83ad716d0cfc4b0520a19b4d8b24c79d1538","analyzedAt":"2026-08-09T15:32:58.770Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}