spring-projects/spring-framework · error · IllegalArgumentException

Class name [{}] is not a known auto-proxy creator class

Error message

Class name [{}] is not a known auto-proxy creator class

What it means

Thrown by AopConfigUtils.findPriorityForClass(String) when the bean class name of an already-registered auto-proxy creator (under AUTO_PROXY_CREATOR_BEAN_NAME) does not match any class in the internal escalation priority list (InfrastructureAdvisorAutoProxyCreator, AspectJAwareAdvisorAutoProxyCreator, AnnotationAwareAspectJAutoProxyCreator). This happens when a user manually registers a bean under the internal bean name with a custom/unknown class, breaking the escalation protocol.

Source

Thrown at spring-aop/src/main/java/org/springframework/aop/config/AopConfigUtils.java:155

		beanDefinition.setSource(source);
		beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
		beanDefinition.getPropertyValues().add("order", Ordered.HIGHEST_PRECEDENCE);
		registry.registerBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME, beanDefinition);
		return beanDefinition;
	}

	private static int findPriorityForClass(Class<?> clazz) {
		return APC_PRIORITY_LIST.indexOf(clazz);
	}

	private static int findPriorityForClass(@Nullable String className) {
		for (int i = 0; i < APC_PRIORITY_LIST.size(); i++) {
			Class<?> clazz = APC_PRIORITY_LIST.get(i);
			if (clazz.getName().equals(className)) {
				return i;
			}
		}
		throw new IllegalArgumentException(
				"Class name [" + className + "] is not a known auto-proxy creator class");
	}

}

View on GitHub (pinned to e8729d0438)

Solutions

  1. Do not register beans under 'org.springframework.aop.config.internalAutoProxyCreator'; let Spring register the auto-proxy creator itself.
  2. If you need a custom auto-proxy creator, extend one of the three known classes (e.g. AnnotationAwareAspectJAutoProxyCreator) so its class name remains recognized, or register it under a different bean name and order it appropriately.
  3. Remove the conflicting bean definition and rely on @EnableAspectJAutoProxy / <aop:config> to install the creator.

Example fix

// before — user manually registered the infra bean with a custom class
@Bean(name = "org.springframework.aop.config.internalAutoProxyCreator")
public BeanPostProcessor myCreator() { return new MyCustomCreator(); }
// after — register the custom creator under its own name and extend a known class
@Bean
public AnnotationAwareAspectJAutoProxyCreator myCreator() {
  AnnotationAwareAspectJAutoProxyCreator c = new AnnotationAwareAspectJAutoProxyCreator();
  return c;
}
Defensive patterns

Strategy: validation

Validate before calling

import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

void ensureNoConflictingAutoProxyBean(ConfigurableListableBeanFactory bf) {
  String name = "org.springframework.aop.config.internalAutoProxyCreator";
  if (bf.containsBeanDefinition(name)) {
    String cls = bf.getBeanDefinition(name).getBeanClassName();
    if (!java.util.List.of(
        "org.springframework.aop.framework.autoproxy.InfrastructureAdvisorAutoProxyCreator",
        "org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator",
        "org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator")
        .contains(cls))
      throw new IllegalStateException("Bean '" + name + "' has unknown class " + cls);
  }
}

Prevention

When it happens

Trigger: Registering a bean definition under the name 'org.springframework.aop.config.internalAutoProxyCreator' with a bean class that is not one of the three known auto-proxy creator classes, then triggering registerOrEscalateApcAsRequired via <aop:config>, @EnableAspectJAutoProxy, or @EnableTransactionManagement.

Common situations: A user or a library manually defines a bean named internalAutoProxyCreator with a custom BeanPostProcessor class. Copy-pasting infrastructure bean names into user config. A misbehaving third-party starter that overrides the internal bean name.

Related errors


AI-assisted analysis of spring-projects/spring-framework@e8729d0438 (2026-08-04). Data as JSON: /data/errors/d5aa8aaab93180c2.json. Report an issue: GitHub.