spring-projects/spring-framework · error · IllegalArgumentException
targetField is required
Error message
targetField is required
What it means
Error "targetField is required" thrown in spring-projects/spring-framework.
Source
Thrown at spring-beans/src/main/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.java:194
Assert.state(this.staticField != null, "No target field specified");
}
// Try to parse static field into class and field.
int lastDotIndex = this.staticField.lastIndexOf('.');
if (lastDotIndex == -1 || lastDotIndex == this.staticField.length()) {
throw new IllegalArgumentException(
"staticField must be a fully qualified class plus static field name: " +
"for example, 'example.MyExampleClass.MY_EXAMPLE_FIELD'");
}
String className = this.staticField.substring(0, lastDotIndex);
String fieldName = this.staticField.substring(lastDotIndex + 1);
this.targetClass = ClassUtils.forName(className, this.beanClassLoader);
this.targetField = fieldName;
}
else if (this.targetField == null) {
// Either targetClass or targetObject specified.
throw new IllegalArgumentException("targetField is required");
}
// Try to get the exact method first.
Class<?> targetClass = (this.targetObject != null ? this.targetObject.getClass() : this.targetClass);
this.fieldObject = targetClass.getField(this.targetField);
}
@Override
public @Nullable Object getObject() throws IllegalAccessException {
if (this.fieldObject == null) {
throw new FactoryBeanNotInitializedException();
}
ReflectionUtils.makeAccessible(this.fieldObject);
if (this.targetObject != null) {
// instance field
return this.fieldObject.get(this.targetObject);
}View on GitHub (pinned to e8729d0438)
When it happens
Trigger: Thrown at spring-beans/src/main/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.java:194 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of spring-projects/spring-framework@e8729d0438 (2026-08-04).
Data as JSON: /data/errors/2cb2b356ba2024be.json.
Report an issue: GitHub.