SpEL Articles
2 articles about SpEL. Explore Spring Boot implementation, design, and operations across related topics.
-
How to Control Cache Keys with @Cacheable in Spring Boot - Choosing Between SpEL in the key Attribute, KeyGenerator, condition/unless, and @Caching
You added @Cacheable, yet different arguments return the same result, or null values end up cached. This guide covers Spring Boot 3.x: the key resolution rules of SimpleKeyGenerator, SpEL in the key attribute, custom KeyGenerator implementations, condition/unless, and when to use @Caching, and finishes with tests that verify cache keys using Caffeine stats.
-
Spring Security Method Security - How to Implement RBAC with @PreAuthorize
A practical explanation of method-level authorization in Spring Security (@PreAuthorize/@PostAuthorize/@Secured) with real examples. Covers code for the self-invocation pitfall where AOP doesn't apply, how to choose between hasRole/hasAuthority, the steps to enable @EnableMethodSecurity, SpEL-based owner checks, and testing with @WithMockUser.