diff --git a/config/src/main/java/org/springframework/security/config/annotation/method/configuration/MethodSecurityConfiguration.java b/config/src/main/java/org/springframework/security/config/annotation/method/configuration/MethodSecurityConfiguration.java index dda256507d..98b0495a5c 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/method/configuration/MethodSecurityConfiguration.java +++ b/config/src/main/java/org/springframework/security/config/annotation/method/configuration/MethodSecurityConfiguration.java @@ -107,7 +107,11 @@ final class MethodSecurityConfiguration implements ImportAware, InitializingBean private MethodSecurityExpressionHandler getMethodSecurityExpressionHandler() { if (this.methodSecurityExpressionHandler == null) { - this.methodSecurityExpressionHandler = new DefaultMethodSecurityExpressionHandler(); + DefaultMethodSecurityExpressionHandler methodSecurityExpressionHandler = new DefaultMethodSecurityExpressionHandler(); + if (this.grantedAuthorityDefaults != null) { + methodSecurityExpressionHandler.setDefaultRolePrefix(this.grantedAuthorityDefaults.getRolePrefix()); + } + this.methodSecurityExpressionHandler = methodSecurityExpressionHandler; } return this.methodSecurityExpressionHandler; }