{"id":"db11431e2225f4e3","repo":"spring-projects/spring-framework","slug":"injection-of-autowired-dependencies-failed-for-cla","errorCode":null,"errorMessage":"Injection of autowired dependencies failed for class [${clazz}]","messagePattern":"Injection of autowired dependencies failed for class \\[(.+?)\\]","errorType":"exception","errorClass":"BeanCreationException","httpStatus":null,"severity":"error","filePath":"spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java","lineNumber":522,"sourceCode":"\t/**\n\t * <em>Native</em> processing method for direct calls with an arbitrary target\n\t * instance, resolving all of its fields and methods which are annotated with\n\t * one of the configured 'autowired' annotation types.\n\t * @param bean the target instance to process\n\t * @throws BeanCreationException if autowiring failed\n\t * @see #setAutowiredAnnotationTypes(Set)\n\t */\n\tpublic void processInjection(Object bean) throws BeanCreationException {\n\t\tClass<?> clazz = bean.getClass();\n\t\tInjectionMetadata metadata = findAutowiringMetadata(clazz.getName(), clazz, null);\n\t\ttry {\n\t\t\tmetadata.inject(bean, null, null);\n\t\t}\n\t\tcatch (BeanCreationException ex) {\n\t\t\tthrow ex;\n\t\t}\n\t\tcatch (Throwable ex) {\n\t\t\tthrow new BeanCreationException(\n\t\t\t\t\t\"Injection of autowired dependencies failed for class [\" + clazz + \"]\", ex);\n\t\t}\n\t}\n\n\tprivate InjectionMetadata findAutowiringMetadata(String beanName, Class<?> clazz, @Nullable PropertyValues pvs) {\n\t\t// Fall back to class name as cache key, for backwards compatibility with custom callers.\n\t\tString cacheKey = (StringUtils.hasLength(beanName) ? beanName : clazz.getName());\n\t\t// Quick check on the concurrent map first, with minimal locking.\n\t\tInjectionMetadata metadata = this.injectionMetadataCache.get(cacheKey);\n\t\tif (InjectionMetadata.needsRefresh(metadata, clazz)) {\n\t\t\tsynchronized (this.injectionMetadataCache) {\n\t\t\t\tmetadata = this.injectionMetadataCache.get(cacheKey);\n\t\t\t\tif (InjectionMetadata.needsRefresh(metadata, clazz)) {\n\t\t\t\t\tif (metadata != null) {\n\t\t\t\t\t\tmetadata.clear(pvs);\n\t\t\t\t\t}\n\t\t\t\t\tmetadata = buildAutowiringMetadata(clazz);\n\t\t\t\t\tthis.injectionMetadataCache.put(cacheKey, metadata);","sourceCodeStart":504,"sourceCodeEnd":540,"githubUrl":"https://github.com/spring-projects/spring-framework/blob/e8729d043887bf0d0baf91e062e909b56eb2b708/spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java#L504-L540","documentation":"Error \"Injection of autowired dependencies failed for class [${clazz}]\" thrown in spring-projects/spring-framework.","triggerScenarios":"Thrown at spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java:522 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}