concept custom annotation in category spring
appears as: custom notation, custom annotation

This is an excerpt from Manning's book Spring Security in Action.
Link the custom annotation created in step 1 with the factory class created in step 2 via the @WithSecurityContext annotation.
Step 3 – Link the custom annotation to the factory class
Using the @WithSecurityContext annotation, we now link the custom annotation we created in step 1 to the factory class for the SecurityContext we implemented in step 2. Listing 20.10 presents the change I’ve made to our @WithCustomUser annotation to link it to the SecurityContext factory class.
Listing 20.10 Linking the custom annotation to the SecurityContext factory class
@Retention(RetentionPolicy.RUNTIME) @WithSecurityContext(factory = CustomSecurityContextFactory.class) public @interface WithCustomUser { String username(); }