{"record":{"id":"75a00c9170c24e14","repo":"spring-projects/spring-framework","slug":"failed-properties-propertyaccessexceptions","errorCode":null,"errorMessage":"Failed properties: {propertyAccessExceptions}","messagePattern":"Failed properties: (.+?)","errorType":"exception","errorClass":"PropertyBatchUpdateException","httpStatus":null,"severity":"error","filePath":"spring-beans/src/main/java/org/springframework/beans/AbstractPropertyAccessor.java","lineNumber":147,"sourceCode":"\t\t\t\t}\n\t\t\t\tcatch (PropertyAccessException ex) {\n\t\t\t\t\tif (propertyAccessExceptions == null) {\n\t\t\t\t\t\tpropertyAccessExceptions = new ArrayList<>();\n\t\t\t\t\t}\n\t\t\t\t\tpropertyAccessExceptions.add(ex);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfinally {\n\t\t\tif (ignoreUnknown) {\n\t\t\t\tthis.suppressNotWritablePropertyException = false;\n\t\t\t}\n\t\t}\n\n\t\t// If we encountered individual exceptions, throw the composite exception.\n\t\tif (propertyAccessExceptions != null) {\n\t\t\tPropertyAccessException[] paeArray = propertyAccessExceptions.toArray(new PropertyAccessException[0]);\n\t\t\tthrow new PropertyBatchUpdateException(paeArray);\n\t\t}\n\t}\n\n\n\t// Redefined with public visibility.\n\t@Override\n\tpublic @Nullable Class<?> getPropertyType(String propertyPath) {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Actually get the value of a property.\n\t * @param propertyName name of the property to get the value of\n\t * @return the value of the property\n\t * @throws InvalidPropertyException if there is no such property or\n\t * if the property isn't readable\n\t * @throws PropertyAccessException if the property was valid but the\n\t * accessor method failed","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/spring-projects/spring-framework/blob/69bf83ad716d0cfc4b0520a19b4d8b24c79d1538/spring-beans/src/main/java/org/springframework/beans/AbstractPropertyAccessor.java#L129-L165","documentation":"Thrown as PropertyBatchUpdateException by setPropertyValues at AbstractPropertyAccessor.java:147 after the loop over all PropertyValues accumulates one or more PropertyAccessExceptions (e.g. TypeMismatchException) that are NOT NotWritablePropertyException or NullValueInNestedPathException. Its getMessage() joins the individual exceptions with 'Failed properties: ...'. Binding continues across all properties so multiple errors are collected, then re-thrown together.","triggerScenarios":"Calling setPropertyValues(pvs) (or DataBinder binding) where at least one property triggers a PropertyAccessException such as a TypeMismatchException, MethodInvocationException, or MethodArgumentTypeMismatch — while other properties bind fine. The non-critical exceptions are collected rather than aborting the whole batch.","commonSituations":"Spring MVC form binding where several fields fail type conversion at once (e.g. 'abc' into an Integer and a malformed date); @ConfigurationProperties binding with multiple bad values; BeanWrapper bulk copy with type mismatches across fields; the typical 'many validation errors in one submit' scenario.","solutions":["Iterate getExceptionCount()/getPropertyAccessExceptions() on the PropertyBatchUpdateException to see each failing property individually.","Fix each reported property's input value or register the right converter/PropertyEditor/ConversionService.","Use a DataBinder with a BindingResult to capture errors per-field instead of letting raw exceptions propagate.","If you expect unknown paths, call setPropertyValues(pvs, true) to ignore NotWritablePropertyException separately."],"exampleFix":"// before\ntry {\n    wrapper.setPropertyValues(pvs);\n} catch (BeansException ex) {\n    log.error(\"binding failed\", ex); // loses field-level detail\n}\n\n// after\ntry {\n    wrapper.setPropertyValues(pvs);\n} catch (PropertyBatchUpdateException ex) {\n    for (PropertyAccessException pae : ex.getPropertyAccessExceptions()) {\n        log.warn(\"field {} : {}\", pae.getPropertyName(), pae.getMessage());\n    }\n}","handlingStrategy":"try-catch","validationCode":"// Pre-validate types per property before bulk set\nConversionService cs = wrapper.getConversionService();\nfor (PropertyValue pv : pvs) {\n    Class<?> needed = wrapper.getPropertyType(pv.getName());\n    if (needed != null && pv.getValue() != null && cs != null\n            && !cs.canConvert(pv.getValue().getClass(), needed)) {\n        log.warn(\"will fail: {} -> {}\", pv.getName(), needed);\n    }\n}","typeGuard":"static boolean allBindable(BeanWrapper w, PropertyValues pvs) {\n    for (PropertyValue pv : pvs.getPropertyValues()) {\n        Class<?> t = w.getPropertyType(pv.getName());\n        if (t == null) return false;\n    }\n    return true;\n}","tryCatchPattern":"try {\n    wrapper.setPropertyValues(pvs);\n} catch (PropertyBatchUpdateException ex) {\n    for (PropertyAccessException pae : ex.getPropertyAccessExceptions()) {\n        errors.rejectValue(pae.getPropertyName(), \"typeMismatch\", pae.getMessage());\n    }\n}","preventionTips":["Use a DataBinder + BindingResult to collect field errors instead of propagating the raw batch exception.","Register a ConversionService/PropertyEditor for non-standard types up front.","Validate input (Bean Validation) before binding to catch bad values early.","Inspect every PropertyAccessException in the batch — they each point to one property."],"tags":["spring-beans","binding","type-mismatch","batch","property-access"],"backgroundTag":null,"analyzedSha":"69bf83ad716d0cfc4b0520a19b4d8b24c79d1538","analyzedAt":"2026-08-09T15:32:58.770Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}