{"id":"d5aa8aaab93180c2","repo":"spring-projects/spring-framework","slug":"class-name-is-not-a-known-auto-proxy-creator","errorCode":null,"errorMessage":"Class name [{}] is not a known auto-proxy creator class","messagePattern":"Class name \\[(.+?)\\] is not a known auto-proxy creator class","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spring-aop/src/main/java/org/springframework/aop/config/AopConfigUtils.java","lineNumber":155,"sourceCode":"\t\tbeanDefinition.setSource(source);\n\t\tbeanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);\n\t\tbeanDefinition.getPropertyValues().add(\"order\", Ordered.HIGHEST_PRECEDENCE);\n\t\tregistry.registerBeanDefinition(AUTO_PROXY_CREATOR_BEAN_NAME, beanDefinition);\n\t\treturn beanDefinition;\n\t}\n\n\tprivate static int findPriorityForClass(Class<?> clazz) {\n\t\treturn APC_PRIORITY_LIST.indexOf(clazz);\n\t}\n\n\tprivate static int findPriorityForClass(@Nullable String className) {\n\t\tfor (int i = 0; i < APC_PRIORITY_LIST.size(); i++) {\n\t\t\tClass<?> clazz = APC_PRIORITY_LIST.get(i);\n\t\t\tif (clazz.getName().equals(className)) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\tthrow new IllegalArgumentException(\n\t\t\t\t\"Class name [\" + className + \"] is not a known auto-proxy creator class\");\n\t}\n\n}\n","sourceCodeStart":137,"sourceCodeEnd":160,"githubUrl":"https://github.com/spring-projects/spring-framework/blob/e8729d043887bf0d0baf91e062e909b56eb2b708/spring-aop/src/main/java/org/springframework/aop/config/AopConfigUtils.java#L137-L160","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Do not register beans under 'org.springframework.aop.config.internalAutoProxyCreator'; let Spring register the auto-proxy creator itself.","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.","Remove the conflicting bean definition and rely on @EnableAspectJAutoProxy / <aop:config> to install the creator."],"exampleFix":"// before — user manually registered the infra bean with a custom class\n@Bean(name = \"org.springframework.aop.config.internalAutoProxyCreator\")\npublic BeanPostProcessor myCreator() { return new MyCustomCreator(); }\n// after — register the custom creator under its own name and extend a known class\n@Bean\npublic AnnotationAwareAspectJAutoProxyCreator myCreator() {\n  AnnotationAwareAspectJAutoProxyCreator c = new AnnotationAwareAspectJAutoProxyCreator();\n  return c;\n}","handlingStrategy":"validation","validationCode":"import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;\n\nvoid ensureNoConflictingAutoProxyBean(ConfigurableListableBeanFactory bf) {\n  String name = \"org.springframework.aop.config.internalAutoProxyCreator\";\n  if (bf.containsBeanDefinition(name)) {\n    String cls = bf.getBeanDefinition(name).getBeanClassName();\n    if (!java.util.List.of(\n        \"org.springframework.aop.framework.autoproxy.InfrastructureAdvisorAutoProxyCreator\",\n        \"org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator\",\n        \"org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator\")\n        .contains(cls))\n      throw new IllegalStateException(\"Bean '\" + name + \"' has unknown class \" + cls);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never register beans under the internal 'internalAutoProxyCreator' name.","Let @EnableAspectJAutoProxy / <aop:config> install the auto-proxy creator.","If you need a custom creator, extend AnnotationAwareAspectJAutoProxyCreator and register under a distinct bean name."],"tags":["spring-aop","auto-proxy","configuration","bean-registration"],"analyzedSha":"e8729d043887bf0d0baf91e062e909b56eb2b708","analyzedAt":"2026-08-04T19:07:39.725Z","schemaVersion":2}