Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

389
Views
Spring Aspectj @Before all rest método

Antes de la primavera, presente @GetMapping , solo hay una anotación que nos importa @RequestMapping , por lo tanto, este aspecto funciona

 @Before("within(aa.bb.*.rest..*) && execution(public * *(..)) && @within(org.springframework.web.bind.annotation.RestController) && @annotation(org.springframework.web.bind.annotation.RequestMapping)")

Pero después podemos usar @GetMapping , @PostMapping , este punto no funciona, pero estas anotaciones tienen una meta anotación @RequestMapping .

¿Hay alguna forma de interceptar fácilmente todos los @RequestMapping / @{Get,Post,Put,Patch,..}Mapping ?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

¡Encontré que esta sintaxis aquí funciona para mí!

 @Pointcut("execution(@(@org.springframework.web.bind.annotation.RequestMapping *) * *(..))") public void requestMappingAnnotations() { }

También puedo enumerarlos a todos.

 @Pointcut("within(aa.bb.*.rest..*) && @within(org.springframework.web.bind.annotation.RestController)") public void restControllers() {} @Pointcut("@annotation(org.springframework.web.bind.annotation.RequestMapping) " + "|| @annotation(org.springframework.web.bind.annotation.GetMapping)" + "|| @annotation(org.springframework.web.bind.annotation.PostMapping)" + "|| @annotation(org.springframework.web.bind.annotation.PatchMapping)" + "|| @annotation(org.springframework.web.bind.annotation.PutMapping)" + "|| @annotation(org.springframework.web.bind.annotation.DeleteMapping)" ) public void mappingAnnotations() {} @Pointcut("execution(@(@org.springframework.web.bind.annotation.RequestMapping *) * *(..))") public void requestMappingAnnotations() { } @Before("restControllers() && requestMappingAnnotations()") public void onExecute(JoinPoint jp) {}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!