Tuesday, 14 March 2023

Create own annotation in springboot

 https://fullstackdeveloper.guru/2021/06/15/how-to-create-a-custom-annotation-in-spring-boot/

 

 

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface LogMyMethodAnnotation {

}

 

@Aspect
@Component
public class LogMyMethodAnnotationAspect {

@Around("@annotation(LogMyMethodAnnotation)")
public void logMyController(ProceedingJoinPoint joinPoint){
System.out.println("pawankumar--------");
System.out.println("joinPoint"+joinPoint.getArgs().toString());
}
}

 

@LogMyMethodAnnotation
@RequestMapping(method = RequestMethod.GET, value = "game/get_game_profile_data")

 

 

No comments:

Post a Comment