我有简单的feignclient,如下所示
@FeignClient(name="xxx")
public interface XXXServiceClient {
@RequestMapping(value = "/foo/bar", method = RequestMethod.POST)
public ResponseEntity<XXX> doSomething(@RequestBody XXX args);
}
我想要的是定义基于弹簧的切入点和之前的建议。我可以为具有特定注释的类定义切入点,但它不适用于 feignclient 接口。
例子
@Pointcut("within(@org.springframework.stereotype.Controller *)")
public void controllerMethods() {}
@Before("controllerMethods()")
public void controllerMethodsBeforeAdvice(JoinPoint pjp) {
System.out.println("Working");
}
@Pointcut("within(@org.springframework.cloud.netflix.feign.FeignClient *)")
public void feignClientMethods() {}
@Before("feignClientMethods()")
public void feignClientMethodsBeforeAdvice(JoinPoint pjp) {
System.out.println("Not working");
}