Прежде чем совет не выполняется - PullRequest
0 голосов
/ 28 июня 2018

Я пытаюсь вызвать предыдущий совет, но он не выполняется с определенной точкой

У меня есть основное приложение в упаковке com.my.ms

@SpringBootApplication
@EnableAspectJAutoProxy
public class TemplateServiceApplication {

public static void main(String[] args) {

    SpringApplication.run(TemplateServiceApplication.class, args);
}

}

и в пакете com.my.ms.tst.advices у меня есть совет перед

@Aspect
public class ValidatingAdvices {

@Before(value = "execution(* com.my.ms.tst.api.*.get*(..))")
public void validateKey(JoinPoint joinPoint) throws Throwable {
     System.out.println("Executing the before advice");
 }

}

контроллер лежит в пакете com.my.ms.tst.api

@Controller
@RequestMapping("/ts")
public class MainController {



@GetMapping("/check")
public String getTemp() throws IOException {

    return "five";
}

}

Но приведенный ниже совет не выполняется

1 Ответ

0 голосов
/ 28 июня 2018

Вы добавляете аннотацию @Configuration в ValidatingAdvices .

   @Configuration
    @Aspect
    public class ValidatingAdvices {

    @Before(value = "execution(* com.my.ms.tst.api.*.get*(..))")
    public void validateKey(JoinPoint joinPoint) throws Throwable {
         System.out.println("Executing the before advice");
     }

    }
...