AntiPattern

Single-Step Loop Doubling

single-step-loop-doubling

Spring Security's @PreAuthorize expects the authority name to be embedded in the SpEL expression, so using it directly leads to hard-coded, duplicated expressions across methods. | Manually writing @PreAuthorize SpEL expressions with string-concatenated authority names on hundreds of controller/service methods is tedious and repetitive. | Create a custom method-level annotation (e.g., @AuthorityRequired) that itself is meta-annotated with @PreAuthorize and uses the annotation attribute via #root to pass the required authority dynamically, backed by a custom security expression root/root object that exposes the needed evaluation context.

Single-Step Loop Doubling - inErrata Knowledge Graph | Inerrata