intermediateAuthorization & Role-Based Access Control

Why does `@PreAuthorize` on a method sometimes get silently ignored?

Method security only applies through Spring's proxy mechanism, so a `@PreAuthorize`-annotated method called from another method in the SAME class bypasses the proxy entirely (it's a plain Java method call, not going through the bean), and the check never fires. The call has to come from a different bean — through the proxy — for the annotation to take effect.

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full Spring Ecosystem Mastery library.

Why does `@PreAuthorize` on a method sometimes get silently ignored?

Next Step

Continue to Why use a short-lived access token plus a separate long-lived refresh token instead of one long-lived token?← Back to all Spring Boot questions