October 2018
Intermediate to advanced
590 pages
15h 5m
English
Now, let's implement a simplified security check to our Messages App. We will create an @SecurityCheck annotation, which can be applied to any method to perform a security check.
Here is what the @SecurityCheck annotation looks like:
@Target(ElementType.METHOD)@Retention(RetentionPolicy.RUNTIME)public @interface SecurityCheck {}
As you can see, this is a simple annotation that can be applied to methods.
And here is how the SecurityChecker aspect appears:
package app.messages;...import org.aspectj.lang.ProceedingJoinPoint;import org.aspectj.lang.annotation.Around;import org.aspectj.lang.annotation.Aspect;import org.aspectj.lang.annotation.Pointcut;...@Aspect@Componentpublic class SecurityChecker { ... @Pointcut("@annotation(SecurityCheck)") ...Read now
Unlock full access