Use Cases
1. Perform Authorization Check with the help of HTTP Request Headers
Context
Solution
Create the Custom Annotation
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface RequireAuthorization {
String role() default "ADMIN";
}Create the Aspect
Define Custom Exception
Apply the Annotation on a Controller or Service Method
2. Trigger an Notification Event on Successful Payment Response
Approach
Solution
Custom Annotation
Event Class
Aspect to Intercept and Publish Event
Sample Controller
Event Listener
Last updated