{"id":"f8c2c2c97f0812ef","repo":"spring-projects/spring-framework","slug":"invalid-autowire-marked-constructors-candidates","errorCode":null,"errorMessage":"Invalid autowire-marked constructors: ${candidates}. Found constructor with 'required' Autowired annotation: ${candidate}","messagePattern":"Invalid autowire-marked constructors: (.+?)\\. Found constructor with 'required' Autowired annotation: (.+?)","errorType":"exception","errorClass":"BeanCreationException","httpStatus":null,"severity":"error","filePath":"spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java","lineNumber":406,"sourceCode":"\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;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!candidates.isEmpty()) {\n\t\t\t\t\t\t// Add default constructor to list of optional constructors, as fallback.\n\t\t\t\t\t\tif (requiredConstructor == null) {\n\t\t\t\t\t\t\tif (defaultConstructor != null) {\n\t\t\t\t\t\t\t\tcandidates.add(defaultConstructor);\n\t\t\t\t\t\t\t}","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/spring-projects/spring-framework/blob/e8729d043887bf0d0baf91e062e909b56eb2b708/spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java#L388-L424","documentation":"Error \"Invalid autowire-marked constructors: ${candidates}. Found constructor with 'required' Autowired annotation: ${candidate}\" thrown in spring-projects/spring-framework.","triggerScenarios":"Thrown at spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java:406 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}