spring-projects/spring-framework · error · IllegalArgumentException
AdvisorAutoProxyCreator requires a ConfigurableListableBeanF
Error message
AdvisorAutoProxyCreator requires a ConfigurableListableBeanFactory: {beanFactory} What it means
AbstractAdvisorAutoProxyCreator.setBeanFactory() requires the factory to be a ConfigurableListableBeanFactory because it must register a BeanFactoryAdvisorRetrievalHelperAdapter and introspect bean definitions. A plain BeanFactory (or non-ConfigurableListable) cannot support advisor retrieval, so IllegalArgumentException is thrown during context setup.
Source
Thrown at spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAdvisorAutoProxyCreator.java:64
* not annotated with {@code @Order} or don't implement the {@code Ordered}
* interface will be considered as unordered; they will appear at the end of the
* advisor chain in an undefined order.
*
* @author Rod Johnson
* @author Juergen Hoeller
* @see #findCandidateAdvisors
*/
@SuppressWarnings("serial")
public abstract class AbstractAdvisorAutoProxyCreator extends AbstractAutoProxyCreator {
private @Nullable BeanFactoryAdvisorRetrievalHelper advisorRetrievalHelper;
@Override
public void setBeanFactory(BeanFactory beanFactory) {
super.setBeanFactory(beanFactory);
if (!(beanFactory instanceof ConfigurableListableBeanFactory clbf)) {
throw new IllegalArgumentException(
"AdvisorAutoProxyCreator requires a ConfigurableListableBeanFactory: " + beanFactory);
}
initBeanFactory(clbf);
}
protected void initBeanFactory(ConfigurableListableBeanFactory beanFactory) {
this.advisorRetrievalHelper = new BeanFactoryAdvisorRetrievalHelperAdapter(beanFactory);
}
@Override
protected Object @Nullable [] getAdvicesAndAdvisorsForBean(
Class<?> beanClass, String beanName, @Nullable TargetSource targetSource) {
List<Advisor> advisors = findEligibleAdvisors(beanClass, beanName);
if (advisors.isEmpty()) {
return DO_NOT_PROXY;
}View on GitHub (pinned to e8729d0438)
Solutions
- Use a Spring ApplicationContext (ClassPathXmlApplicationContext, AnnotationConfigApplicationContext) which always provides a ConfigurableListableBeanFactory.
- If wiring manually, pass an instance of DefaultListableBeanFactory.
- Ensure no custom BeanFactory decorator strips the ConfigurableListable interface.
Example fix
// before BeanFactory bf = new SimpleJndiBeanFactory(); // not listable autoProxyCreator.setBeanFactory(bf); // after DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); autoProxyCreator.setBeanFactory(bf);
Defensive patterns
Strategy: validation
Validate before calling
if (!(beanFactory instanceof org.springframework.beans.factory.config.ConfigurableListableBeanFactory)) {
throw new IllegalStateException("Auto-proxy creator requires ConfigurableListableBeanFactory, got: " + beanFactory.getClass());
}
autoProxyCreator.setBeanFactory(beanFactory); Type guard
public static boolean isConfigurableListable(BeanFactory bf) {
return bf instanceof org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
} Prevention
- Bootstrap AOP inside an ApplicationContext (always provides a ConfigurableListableBeanFactory).
- When wiring programmatically, pass a DefaultListableBeanFactory.
- Avoid decorator BeanFactories that hide the ConfigurableListable interface.
When it happens
Trigger: Wiring an AdvisorAutoProxyCreator (DefaultAdvisorAutoProxyCreator, or annotation-driven infrastructure that builds one) into a container that supplies a non-ConfigurableListableBeanFactory; programmatically calling setBeanFactory() with a custom minimal BeanFactory.
Common situations: Custom lightweight containers; misconfigured bean factory post-processing; embedding Spring AOP in a non-standard environment; using a static/legacy BeanFactory instead of an ApplicationContext.
Related errors
- Class name [{}] is not a known auto-proxy creator class
- Can't determine type of bean with name '{}'
- No BeanFactory available anymore (probably due to serializat
- Target required after globals
- Can only use global advisors or interceptors with a Listable
AI-assisted analysis of spring-projects/spring-framework@e8729d0438 (2026-08-04).
Data as JSON: /data/errors/18888d23be8fe78a.json.
Report an issue: GitHub.