{"record":{"id":"1e8f175e4e229751","repo":"spring-projects/spring-security","slug":"advicemode-advicemode-is-not-supported-1e8f17","errorCode":null,"errorMessage":"AdviceMode {adviceMode} is not supported","messagePattern":"AdviceMode (.+?) is not supported","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"config/src/main/java/org/springframework/security/config/annotation/method/configuration/ReactiveMethodSecuritySelector.java","lineNumber":92,"sourceCode":"\t\tif (isObservabilityPresent) {\n\t\t\timports.add(ReactiveMethodObservationConfiguration.class.getName());\n\t\t}\n\t\timports.add(AuthorizationProxyConfiguration.class.getName());\n\t\treturn imports.toArray(new String[0]);\n\t}\n\n\tprivate static final class AutoProxyRegistrarSelector\n\t\t\textends AdviceModeImportSelector<EnableReactiveMethodSecurity> {\n\n\t\tprivate static final String[] IMPORTS = new String[] { AutoProxyRegistrar.class.getName(),\n\t\t\t\tMethodSecurityAdvisorRegistrar.class.getName() };\n\n\t\t@Override\n\t\tprotected String[] selectImports(@NonNull AdviceMode adviceMode) {\n\t\t\tif (adviceMode == AdviceMode.PROXY) {\n\t\t\t\treturn IMPORTS;\n\t\t\t}\n\t\t\tthrow new IllegalStateException(\"AdviceMode \" + adviceMode + \" is not supported\");\n\t\t}\n\n\t}\n\n}\n","sourceCodeStart":74,"sourceCodeEnd":98,"githubUrl":"https://github.com/spring-projects/spring-security/blob/96852e8860138a482cb13d1479573f24ff6443c6/config/src/main/java/org/springframework/security/config/annotation/method/configuration/ReactiveMethodSecuritySelector.java#L74-L98","documentation":"ReactiveMethodSecuritySelector selects imports for reactive method security based on the AdviceMode of @EnableReactiveMethodSecurity. Only AdviceMode.PROXY is supported; any other mode (e.g. ASPECTJ) throws this IllegalStateException because reactive method security has no AspectJ implementation.","triggerScenarios":"Declaring adviceMode = AdviceMode.ASPECTJ (or any non-PROXY value) on @EnableReactiveMethodSecurity.","commonSituations":"Developers copy the adviceMode attribute from @EnableGlobalMethodSecurity (which supports ASPECTJ) onto the reactive annotation; refactoring shared meta-annotations between servlet and reactive stacks.","solutions":["Remove the adviceMode attribute so the default PROXY is used","Explicitly set adviceMode = AdviceMode.PROXY on @EnableReactiveMethodSecurity","If AspectJ-style weaving is required for reactive code, implement it outside Spring Security's method-security support"],"exampleFix":"// before\n@EnableReactiveMethodSecurity(adviceMode = AdviceMode.ASPECTJ)\n// after\n@EnableReactiveMethodSecurity","handlingStrategy":"validation","validationCode":"AdviceMode mode = enableReactiveMethodSecurity.adviceMode();\nif (mode != AdviceMode.PROXY) {\n    throw new IllegalArgumentException(\n        \"@EnableReactiveMethodSecurity only supports AdviceMode.PROXY, got: \" + mode);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never set adviceMode = ASPECTJ on @EnableReactiveMethodSecurity; only PROXY exists","Do not copy adviceMode attributes from servlet-side @EnableGlobalMethodSecurity onto the reactive annotation","Omit adviceMode entirely and rely on the PROXY default"],"tags":["spring-security","spring-webflux","reactive","advice-mode"],"backgroundTag":"unsupported-enum-value","analyzedSha":"96852e8860138a482cb13d1479573f24ff6443c6","analyzedAt":"2026-09-10T23:25:23.477Z","contentChangedAt":"2026-09-10T23:25:23.477Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}