spring-projects/spring-framework · error · IllegalArgumentException

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

Error message

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

What it means

Thrown as an IllegalArgumentException from AopConfigUtils.findPriorityForClass(String className) when the supplied class name does not match any of the three registered auto-proxy creator classes (InfrastructureAdvisorAutoProxyCreator, AspectJAwareAdvisorAutoProxyCreator, AnnotationAwareAspectJAutoProxyCreator). This is used internally during auto-proxy creator escalation/registration and indicates the bean class name stored under the internal auto-proxy creator bean name is not a recognized creator type.

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 69bf83ad71)

Solutions

  1. Avoid registering beans under the reserved name org.springframework.aop.config.internalAutoProxyCreator.
  2. Identify and fix the component (third-party handler or custom post-processor) that overwrote the auto-proxy creator bean class name.
  3. Register custom auto-proxy creators under their own bean name rather than the reserved infrastructure name.

Example fix

// before
registry.registerBeanDefinition(
    AopConfigUtils.AUTO_PROXY_CREATOR_BEAN_NAME,
    new RootBeanDefinition(MyCustomAutoProxyCreator.class)); // not in priority list -> throws on escalation
// after
registry.registerBeanDefinition(
    "myCustomAutoProxyCreator",
    new RootBeanDefinition(MyCustomAutoProxyCreator.class));
Defensive patterns

Strategy: validation

Validate before calling

import org.springframework.aop.config.AopConfigUtils;
import org.springframework.beans.factory.config.BeanDefinition;

public static boolean isKnownAutoProxyCreator(String beanClassName) {
    return "org.springframework.aop.framework.autoproxy.InfrastructureAdvisorAutoProxyCreator".equals(beanClassName)
        || "org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator".equals(beanClassName)
        || "org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator".equals(beanClassName);
}

// before any escalation logic that calls findPriorityForClass(className):
if (!isKnownAutoProxyCreator(beanDefinition.getBeanClassName())) {
    throw new IllegalStateException("Unexpected auto-proxy creator class: " + beanDefinition.getBeanClassName());
}

Try / catch

// AopConfigUtils is internal; callers rarely invoke it directly. If extending registration:
try {
    // registration/escalation
} catch (IllegalArgumentException ex) {
    if (ex.getMessage().contains("not a known auto-proxy creator class")) {
        // register your creator under a different bean name
    } else throw ex;
}

Prevention

When it happens

Trigger: An auto-proxy creator bean registered under AUTO_PROXY_CREATOR_BEAN_NAME with an unexpected beanClassName; a third-party namespace handler or a custom BeanDefinitionRegistryPostProcessor that overwrote the internal bean name with a different class; an attempt to escalate/replace the auto-proxy creator with a non-standard class.

Common situations: A misbehaving third-party library that re-registers the internal auto-proxy creator bean name with its own class; manual BeanDefinition manipulation that assigns a wrong class name to the reserved bean name; a stale/corrupted BeanDefinition after a partial context refresh.

Related errors


AI-assisted analysis of spring-projects/spring-framework@69bf83ad71 (2026-08-09). Data as JSON: /api/errors/4cacb3358aa66b69. Report an issue: GitHub.