{"id":"7e8bca8cffb6ef3f","repo":"spring-projects/spring-framework","slug":"invalid-value-value-for-custom-qualifier-type","errorCode":null,"errorMessage":"Invalid value [${value}] for custom qualifier type: needs to be Class or String.","messagePattern":"Invalid value \\[(.+?)\\] for custom qualifier type: needs to be Class or String\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spring-beans/src/main/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurer.java","lineNumber":111,"sourceCode":"\t\t\tif (!(beanFactory instanceof DefaultListableBeanFactory dlbf)) {\n\t\t\t\tthrow new IllegalStateException(\n\t\t\t\t\t\t\"CustomAutowireConfigurer needs to operate on a DefaultListableBeanFactory\");\n\t\t\t}\n\t\t\tif (!(dlbf.getAutowireCandidateResolver() instanceof QualifierAnnotationAutowireCandidateResolver)) {\n\t\t\t\tdlbf.setAutowireCandidateResolver(new QualifierAnnotationAutowireCandidateResolver());\n\t\t\t}\n\t\t\tQualifierAnnotationAutowireCandidateResolver resolver =\n\t\t\t\t\t(QualifierAnnotationAutowireCandidateResolver) dlbf.getAutowireCandidateResolver();\n\t\t\tfor (Object value : this.customQualifierTypes) {\n\t\t\t\tClass<? extends Annotation> customType = null;\n\t\t\t\tif (value instanceof Class) {\n\t\t\t\t\tcustomType = (Class<? extends Annotation>) value;\n\t\t\t\t}\n\t\t\t\telse if (value instanceof String className) {\n\t\t\t\t\tcustomType = (Class<? extends Annotation>) ClassUtils.resolveClassName(className, this.beanClassLoader);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\t\t\"Invalid value [\" + value + \"] for custom qualifier type: needs to be Class or String.\");\n\t\t\t\t}\n\t\t\t\tif (!Annotation.class.isAssignableFrom(customType)) {\n\t\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\t\t\"Qualifier type [\" + customType.getName() + \"] needs to be annotation type\");\n\t\t\t\t}\n\t\t\t\tresolver.addQualifierType(customType);\n\t\t\t}\n\t\t}\n\t}\n\n}\n","sourceCodeStart":93,"sourceCodeEnd":124,"githubUrl":"https://github.com/spring-projects/spring-framework/blob/e8729d043887bf0d0baf91e062e909b56eb2b708/spring-beans/src/main/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurer.java#L93-L124","documentation":"Error \"Invalid value [${value}] for custom qualifier type: needs to be Class or String.\" thrown in spring-projects/spring-framework.","triggerScenarios":"Thrown at spring-beans/src/main/java/org/springframework/beans/factory/annotation/CustomAutowireConfigurer.java:111 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}