spring-projects/spring-framework · error · IllegalArgumentException
staticField must be a fully qualified class plus static fiel
Error message
staticField must be a fully qualified class plus static field name: for example, 'example.MyExampleClass.MY_EXAMPLE_FIELD'
What it means
Error "staticField must be a fully qualified class plus static field name: for example, 'example.MyExampleClass.MY_EXAMPLE_FIELD'" thrown in spring-projects/spring-framework.
Source
Thrown at spring-beans/src/main/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.java:182
throw new IllegalArgumentException("Specify either targetClass or targetObject, not both");
}
if (this.targetClass == null && this.targetObject == null) {
if (this.targetField != null) {
throw new IllegalArgumentException(
"Specify targetClass or targetObject in combination with targetField");
}
// If no other property specified, consider bean name as static field expression.
if (this.staticField == null) {
this.staticField = this.beanName;
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);
}View on GitHub (pinned to e8729d0438)
When it happens
Trigger: Thrown at spring-beans/src/main/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.java:182 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/20b13fa8b8cfdf2b.json.
Report an issue: GitHub.