{"record":{"id":"30b17fd487ac194a","repo":"spring-projects/spring-framework","slug":"advisorautoproxycreator-requires-a-configurablelis","errorCode":null,"errorMessage":"AdvisorAutoProxyCreator requires a ConfigurableListableBeanFactory: {}","messagePattern":"AdvisorAutoProxyCreator requires a ConfigurableListableBeanFactory: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"critical","filePath":"spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAdvisorAutoProxyCreator.java","lineNumber":64,"sourceCode":" * not annotated with {@code @Order} or don't implement the {@code Ordered}\n * interface will be considered as unordered; they will appear at the end of the\n * advisor chain in an undefined order.\n *\n * @author Rod Johnson\n * @author Juergen Hoeller\n * @see #findCandidateAdvisors\n */\n@SuppressWarnings(\"serial\")\npublic abstract class AbstractAdvisorAutoProxyCreator extends AbstractAutoProxyCreator {\n\n\tprivate @Nullable BeanFactoryAdvisorRetrievalHelper advisorRetrievalHelper;\n\n\n\t@Override\n\tpublic void setBeanFactory(BeanFactory beanFactory) {\n\t\tsuper.setBeanFactory(beanFactory);\n\t\tif (!(beanFactory instanceof ConfigurableListableBeanFactory clbf)) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\"AdvisorAutoProxyCreator requires a ConfigurableListableBeanFactory: \" + beanFactory);\n\t\t}\n\t\tinitBeanFactory(clbf);\n\t}\n\n\tprotected void initBeanFactory(ConfigurableListableBeanFactory beanFactory) {\n\t\tthis.advisorRetrievalHelper = new BeanFactoryAdvisorRetrievalHelperAdapter(beanFactory);\n\t}\n\n\n\t@Override\n\tprotected Object @Nullable [] getAdvicesAndAdvisorsForBean(\n\t\t\tClass<?> beanClass, String beanName, @Nullable TargetSource targetSource) {\n\n\t\tList<Advisor> advisors = findEligibleAdvisors(beanClass, beanName);\n\t\tif (advisors.isEmpty()) {\n\t\t\treturn DO_NOT_PROXY;\n\t\t}","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/spring-projects/spring-framework/blob/69bf83ad716d0cfc4b0520a19b4d8b24c79d1538/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAdvisorAutoProxyCreator.java#L46-L82","documentation":"Thrown by AbstractAdvisorAutoProxyCreator.setBeanFactory (line 63-66) when the supplied BeanFactory is not an instance of ConfigurableListableBeanFactory. Advisor-based auto-proxy creators must query and sort Advisor beans and register dependencies, capabilities that only a ConfigurableListableBeanFactory provides, so any other factory type is rejected at wiring time.","triggerScenarios":"Registering a DefaultAdvisorAutoProxyCreator, BeanNameAutoProxyCreator descendant that does advisor retrieval, or AnnotationAwareAspectJAutoProxyCreator against a BeanFactory that is not ConfigurableListableBeanFactory (e.g. a manually constructed SimpleJndiBeanFactory, or a custom minimal BeanFactory). Wiring the auto-proxy creator programmatically with 'beanFactory' that is a plain BeanFactory reference.","commonSituations":"Using a non-ApplicationContext lightweight container in tests. Mis-configuring a custom BeanFactory wrapper that does not extend DefaultListableBeanFactory. Mixing a standalone/portable bean factory abstraction with Spring's auto-proxy support.","solutions":["Use a standard ApplicationContext (ClassPathXmlApplicationContext, AnnotationConfigApplicationContext, etc.) which always provides a ConfigurableListableBeanFactory.","If constructing programmatically, ensure the bean factory is a DefaultListableBeanFactory (which implements ConfigurableListableBeanFactory).","Avoid passing a restricted/custom BeanFactory implementation to the auto-proxy creator; wrap it in a DefaultListableBeanFactory instead."],"exampleFix":"// before\nDefaultAdvisorAutoProxyCreator apc = new DefaultAdvisorAutoProxyCreator();\napc.setBeanFactory(new SimpleJndiBeanFactory()); // not ConfigurableListableBeanFactory\n\n// after\nDefaultListableBeanFactory bf = new DefaultListableBeanFactory();\n// register advisors into bf ...\nDefaultAdvisorAutoProxyCreator apc = new DefaultAdvisorAutoProxyCreator();\napc.setBeanFactory(bf);","handlingStrategy":"validation","validationCode":"DefaultAdvisorAutoProxyCreator apc = new DefaultAdvisorAutoProxyCreator();\nif (!(beanFactory instanceof ConfigurableListableBeanFactory)) {\n    throw new IllegalStateException(\n        \"Use a DefaultListableBeanFactory/ApplicationContext for advisor auto-proxying\");\n}\napc.setBeanFactory(beanFactory);","typeGuard":"import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;\nstatic boolean supportsAdvisorAutoProxy(BeanFactory bf) {\n    return bf instanceof ConfigurableListableBeanFactory;\n}","tryCatchPattern":null,"preventionTips":["Always run Spring AOP auto-proxy creators inside an ApplicationContext.","When constructing containers by hand, prefer DefaultListableBeanFactory.","Do not wrap bean factories in adapters that lose the ConfigurableListableBeanFactory type."],"tags":["spring-aop","auto-proxy","bean-factory","configuration"],"backgroundTag":null,"analyzedSha":"69bf83ad716d0cfc4b0520a19b4d8b24c79d1538","analyzedAt":"2026-08-09T15:32:58.770Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}