{"id":"8120aa076f558cd9","repo":"spring-projects/spring-framework","slug":"proceedingjoinpoint-is-only-supported-for-around-a","errorCode":null,"errorMessage":"ProceedingJoinPoint is only supported for around advice","messagePattern":"ProceedingJoinPoint is only supported for around advice","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java","lineNumber":408,"sourceCode":"\t\t}\n\n\t\tthis.argumentsIntrospected = true;\n\t}\n\n\tprivate boolean maybeBindJoinPoint(Class<?> candidateParameterType) {\n\t\tif (JoinPoint.class == candidateParameterType) {\n\t\t\tthis.joinPointArgumentIndex = 0;\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tprivate boolean maybeBindProceedingJoinPoint(Class<?> candidateParameterType) {\n\t\tif (ProceedingJoinPoint.class == candidateParameterType) {\n\t\t\tif (!supportsProceedingJoinPoint()) {\n\t\t\t\tthrow new IllegalArgumentException(\"ProceedingJoinPoint is only supported for around advice\");\n\t\t\t}\n\t\t\tthis.joinPointArgumentIndex = 0;\n\t\t\treturn true;\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tprotected boolean supportsProceedingJoinPoint() {\n\t\treturn false;\n\t}\n\n\tprivate boolean maybeBindJoinPointStaticPart(Class<?> candidateParameterType) {\n\t\tif (JoinPoint.StaticPart.class == candidateParameterType) {\n\t\t\tthis.joinPointStaticPartArgumentIndex = 0;\n\t\t\treturn true;\n\t\t}","sourceCodeStart":390,"sourceCodeEnd":426,"githubUrl":"https://github.com/spring-projects/spring-framework/blob/e8729d043887bf0d0baf91e062e909b56eb2b708/spring-aop/src/main/java/org/springframework/aop/aspectj/AbstractAspectJAdvice.java#L390-L426","documentation":"Thrown by maybeBindProceedingJoinPoint (line 405-416) when the advice method's first parameter is ProceedingJoinPoint but supportsProceedingJoinPoint() returns false. The base implementation returns false; only AspectJAroundAdvice overrides it to return true. ProceedingJoinPoint.proceed() is only meaningful for around advice, so all other advice kinds reject it.","triggerScenarios":"Declaring a ProceedingJoinPoint parameter on a @Before, @After, @AfterReturning, or @AfterThrowing advice method (or the XML equivalent), where the backing AbstractAspectJAdvice subclass is not AspectJAroundAdvice.","commonSituations":"Copy-pasting an around advice signature into a before/after advice; refactoring @Around to @After without removing the ProceedingJoinPoint parameter; mistakenly thinking all advice kinds can call proceed().","solutions":["Change the advice annotation/element to @Around (or <aop:around>) if you need to call proceed().","Replace ProceedingJoinPoint with JoinPoint in before/after/after-returning/after-throwing advice, which cannot proceed.","Remove the join point parameter entirely if unused."],"exampleFix":"// before\n@After(\"execution(* svc.*(..))\")\npublic void after(ProceedingJoinPoint pjp) { ... }\n// after\n@After(\"execution(* svc.*(..))\")\npublic void after(JoinPoint jp) { ... }","handlingStrategy":"type-guard","validationCode":"// Ensure ProceedingJoinPoint is only used on around advice before registering it.\nClass<?> firstParam = adviceMethod.getParameterTypes()[0];\nif (ProceedingJoinPoint.class == firstParam && !(advice instanceof AspectJAroundAdvice)) {\n    throw new IllegalArgumentException(\n        \"ProceedingJoinPoint parameter requires @Around / <aop:around> on \" + adviceMethod);\n}","typeGuard":"private static boolean usesProceedingJoinPointCorrectly(Method m, AbstractAspectJAdvice a) {\n    Class<?>[] pts = m.getParameterTypes();\n    boolean firstIsPjp = pts.length > 0 && pts[0] == ProceedingJoinPoint.class;\n    return !firstIsPjp || (a instanceof AspectJAroundAdvice);\n}","tryCatchPattern":null,"preventionTips":["Use ProceedingJoinPoint only in @Around advice; use JoinPoint elsewhere.","When converting an @Around to another advice kind, swap ProceedingJoinPoint -> JoinPoint.","Review advice signatures after any annotation/element-kind change."],"tags":["spring-aop","aspectj","around-advice","proceedingjoinpoint","misuse"],"analyzedSha":"e8729d043887bf0d0baf91e062e909b56eb2b708","analyzedAt":"2026-08-04T19:07:39.725Z","schemaVersion":2}