0

I wrote pointcut like this for the target method aaa. I want to enroll whole parameters of target method to the advice method's parameters. Could you let me know how can I make it.

  • target method
fun aaa(    
        @RequestParam(value = "startDate")
        @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) startDate: LocalDate,
        @RequestParam(value = "endDate")
        @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) endDate: LocalDate,
        @ModelAttribute privateInfoRequestDTO: PrivateInfoRequestDTO,
        request: HttpServletRequest
    )
  • advice method's pointcut
@Before("@annotation(com.blah.blah...) && args(privateInfoRequestDTO, startDate, endDate, request)")
kriegaex
  • 63,017
  • 15
  • 111
  • 202
  • Feedback, please. It is not particularly polite to ask questions and then ignore answers. You can either accept my answer or comment, if anything is unclear about it. – kriegaex Nov 21 '21 at 21:51

1 Answers1

0

Try JoinPoint.getArgs, if you need a generic solution matching any numbers and types of parameters.

If you know the relative positions from left or right of the parameters you wish to bind using args(...), such as 1st parameter, 2nd-last parameter etc., of course it is more comfortable and type-safe to stick with args.

Please also read some documentation before asking questions on StackOverflow next time. Thanks.

kriegaex
  • 63,017
  • 15
  • 111
  • 202