{"id":"cadf228f883cd30b","repo":"spring-projects/spring-framework","slug":"invalid-autowire-marked-constructor-candidate","errorCode":null,"errorMessage":"Invalid autowire-marked constructor: ${candidate}. Found constructor with 'required' Autowired annotation already: ${requiredConstructor}","messagePattern":"Invalid autowire-marked constructor: (.+?)\\. Found constructor with 'required' Autowired annotation already: (.+?)","errorType":"exception","errorClass":"BeanCreationException","httpStatus":null,"severity":"error","filePath":"spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java","lineNumber":398,"sourceCode":"\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tMergedAnnotation<?> ann = findAutowiredAnnotation(candidate);\n\t\t\t\t\t\tif (ann == null) {\n\t\t\t\t\t\t\tClass<?> userClass = ClassUtils.getUserClass(beanClass);\n\t\t\t\t\t\t\tif (userClass != beanClass) {\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tConstructor<?> superCtor =\n\t\t\t\t\t\t\t\t\t\t\tuserClass.getDeclaredConstructor(candidate.getParameterTypes());\n\t\t\t\t\t\t\t\t\tann = findAutowiredAnnotation(superCtor);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcatch (NoSuchMethodException ex) {\n\t\t\t\t\t\t\t\t\t// Simply proceed, no equivalent superclass constructor found...\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (ann != null) {\n\t\t\t\t\t\t\tif (requiredConstructor != null) {\n\t\t\t\t\t\t\t\tthrow new BeanCreationException(beanName,\n\t\t\t\t\t\t\t\t\t\t\"Invalid autowire-marked constructor: \" + candidate +\n\t\t\t\t\t\t\t\t\t\t\". Found constructor with 'required' Autowired annotation already: \" +\n\t\t\t\t\t\t\t\t\t\trequiredConstructor);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tboolean required = determineRequiredStatus(ann);\n\t\t\t\t\t\t\tif (required) {\n\t\t\t\t\t\t\t\tif (!candidates.isEmpty()) {\n\t\t\t\t\t\t\t\t\tthrow new BeanCreationException(beanName,\n\t\t\t\t\t\t\t\t\t\t\t\"Invalid autowire-marked constructors: \" + candidates +\n\t\t\t\t\t\t\t\t\t\t\t\". Found constructor with 'required' Autowired annotation: \" +\n\t\t\t\t\t\t\t\t\t\t\tcandidate);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\trequiredConstructor = candidate;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcandidates.add(candidate);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (candidate.getParameterCount() == 0) {\n\t\t\t\t\t\t\tdefaultConstructor = candidate;","sourceCodeStart":380,"sourceCodeEnd":416,"githubUrl":"https://github.com/spring-projects/spring-framework/blob/e8729d043887bf0d0baf91e062e909b56eb2b708/spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java#L380-L416","documentation":"Error \"Invalid autowire-marked constructor: ${candidate}. Found constructor with 'required' Autowired annotation already: ${requiredConstructor}\" thrown in spring-projects/spring-framework.","triggerScenarios":"Thrown at spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java:398 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}