spring-projects/spring-framework · error · InvalidPropertyException

Invalid property '{propertyName}' of bean class [{beanClass.

Error message

Invalid property '{propertyName}' of bean class [{beanClass.getName()}]: No property '{propertyName}' found

What it means

Thrown by BeanWrapperImpl.convertForProperty(value, propertyName) when CachedIntrospectionResults.getPropertyDescriptor(propertyName) returns null - i.e. the bean exposes no property with that name. Spring raises InvalidPropertyException naming the root class and the (nested-path-prefixed) property.

Source

Thrown at spring-beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java:184

		return this.cachedIntrospectionResults;
	}


	/**
	 * Convert the given value for the specified property to the latter's type.
	 * <p>This method is only intended for optimizations in a BeanFactory.
	 * Use the {@code convertIfNecessary} methods for programmatic conversion.
	 * @param value the value to convert
	 * @param propertyName the target property
	 * (note that nested or indexed properties are not supported here)
	 * @return the new value, possibly the result of type conversion
	 * @throws TypeMismatchException if type conversion failed
	 */
	public @Nullable Object convertForProperty(@Nullable Object value, String propertyName) throws TypeMismatchException {
		CachedIntrospectionResults cachedIntrospectionResults = getCachedIntrospectionResults();
		PropertyDescriptor pd = cachedIntrospectionResults.getPropertyDescriptor(propertyName);
		if (pd == null) {
			throw new InvalidPropertyException(getRootClass(), getNestedPath() + propertyName,
					"No property '" + propertyName + "' found");
		}
		TypeDescriptor td = ((GenericTypeAwarePropertyDescriptor) pd).getTypeDescriptor();
		return convertForProperty(propertyName, null, value, td);
	}

	@Override
	protected @Nullable PropertyHandler getLocalPropertyHandler(String propertyName) {
		PropertyDescriptor pd = getCachedIntrospectionResults().getPropertyDescriptor(propertyName);
		return (pd != null ? new BeanPropertyHandler((GenericTypeAwarePropertyDescriptor) pd) : null);
	}

	@Override
	protected BeanWrapperImpl newNestedPropertyAccessor(Object object, String nestedPath) {
		return new BeanWrapperImpl(object, nestedPath, this);
	}

	@Override

View on GitHub (pinned to 69bf83ad71)

Solutions

  1. Verify the property name matches exactly (case-sensitive) a JavaBeans property of the wrapped class.
  2. For nested or indexed properties use setPropertyValue/getPropertyValue or convertForProperty(propertyName, null, value, typeDescriptor) instead of the two-arg overload.
  3. Regenerate/refresh the model class so the expected property exists.

Example fix

// before
wrapper.convertForProperty(value, "user.naem"); // typo

// after
wrapper.convertForProperty(value, "user.name");
Defensive patterns

Strategy: validation

Validate before calling

// before convertForProperty(value, name)
PropertyDescriptor pd = wrapper.getPropertyDescriptor(name);
if (pd == null) {
    throw new IllegalArgumentException("no property " + name);
}
wrapper.convertForProperty(value, name);

Type guard

static boolean hasReadableProperty(BeanWrapper w, String name) {
    try { return w.getPropertyDescriptor(name) != null; }
    catch (InvalidPropertyException e) { return false; }
}

Prevention

When it happens

Trigger: Calling beanWrapper.convertForProperty(value, "xyz") on a wrapped object whose class has no getter/setter for 'xyz'. Note: convertForProperty does not support nested/indexed paths.

Common situations: Typo in the property name, using convertForProperty with a nested path (which it does not support), or a DTO/entity that was regenerated without the expected field.

Related errors


AI-assisted analysis of spring-projects/spring-framework@69bf83ad71 (2026-08-09). Data as JSON: /api/errors/cfdfd7b0c45250da. Report an issue: GitHub.