How do I remove the ROLE_ prefix from Spring Security with JavaConfig?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm trying to remove the "ROLE_" prefix in Spring Security. The first thing I tried was: http . servletApi (). rolePrefix ( "" ); That didn't work, so I tried creating a BeanPostProcessor as suggested in http://docs.spring.io/spring-security/site/migrate/current/3-to-4/html5/migrate-3-to-4-jc.html#m3to4-role-prefixing-disable . That didn't work either. Finally, I tried creating my own SecurityExpressionHandler : @Override protected void configure ( HttpSecurity http ) throws Exception { http . authorizeRequests () .