{"id":"20b13fa8b8cfdf2b","repo":"spring-projects/spring-framework","slug":"staticfield-must-be-a-fully-qualified-class-plus-s","errorCode":null,"errorMessage":"staticField must be a fully qualified class plus static field name: for example, 'example.MyExampleClass.MY_EXAMPLE_FIELD'","messagePattern":"staticField must be a fully qualified class plus static field name: for example, 'example\\.MyExampleClass\\.MY_EXAMPLE_FIELD'","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spring-beans/src/main/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.java","lineNumber":182,"sourceCode":"\t\t\tthrow new IllegalArgumentException(\"Specify either targetClass or targetObject, not both\");\n\t\t}\n\n\t\tif (this.targetClass == null && this.targetObject == null) {\n\t\t\tif (this.targetField != null) {\n\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\t\"Specify targetClass or targetObject in combination with targetField\");\n\t\t\t}\n\n\t\t\t// If no other property specified, consider bean name as static field expression.\n\t\t\tif (this.staticField == null) {\n\t\t\t\tthis.staticField = this.beanName;\n\t\t\t\tAssert.state(this.staticField != null, \"No target field specified\");\n\t\t\t}\n\n\t\t\t// Try to parse static field into class and field.\n\t\t\tint lastDotIndex = this.staticField.lastIndexOf('.');\n\t\t\tif (lastDotIndex == -1 || lastDotIndex == this.staticField.length()) {\n\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\t\"staticField must be a fully qualified class plus static field name: \" +\n\t\t\t\t\t\t\"for example, 'example.MyExampleClass.MY_EXAMPLE_FIELD'\");\n\t\t\t}\n\t\t\tString className = this.staticField.substring(0, lastDotIndex);\n\t\t\tString fieldName = this.staticField.substring(lastDotIndex + 1);\n\t\t\tthis.targetClass = ClassUtils.forName(className, this.beanClassLoader);\n\t\t\tthis.targetField = fieldName;\n\t\t}\n\n\t\telse if (this.targetField == null) {\n\t\t\t// Either targetClass or targetObject specified.\n\t\t\tthrow new IllegalArgumentException(\"targetField is required\");\n\t\t}\n\n\t\t// Try to get the exact method first.\n\t\tClass<?> targetClass = (this.targetObject != null ? this.targetObject.getClass() : this.targetClass);\n\t\tthis.fieldObject = targetClass.getField(this.targetField);\n\t}","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/spring-projects/spring-framework/blob/e8729d043887bf0d0baf91e062e909b56eb2b708/spring-beans/src/main/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.java#L164-L200","documentation":"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.","triggerScenarios":"Thrown at spring-beans/src/main/java/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.java:182 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e8729d043887bf0d0baf91e062e909b56eb2b708","analyzedAt":"2026-08-04T19:07:39.725Z","schemaVersion":2}