0
guice를 사용하여 메소드 인터 셉션을 구현하려고합니다. 메서드에 주석을 달고 가로 채기를 원할 때 bindInterceptor를 호출 할 때 오류가 발생합니다.Java - guice를 사용하는 인터셉트 방법?
오류 : 방법 bindInterceptor (Matcher를, Matcher를 MyInterceptor의가)
내가 뭔가 잘못을하고 있습니까 유형 인 MyModule에 대한 정의되지?
public class MyInterceptor implements MethodInterceptor {
@Override
public Object invoke(MethodInvocation arg0) throws Throwable {
return arg0.proceed();
}
}
public class MyModule extends AbstractModule {
@Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD)
@interface MyAnnotation {}
@Override
protected void configure() {
// I get an error on this line
bindInterceptor(Matchers.any(), Matchers.annotatedWith(MyAnnotation.class),
new MyInterceptor());
}
}
guice 3.0을 사용하여 인터셉터를 컴파일하고 실행하는 데 문제가 없습니다. 수입 명세서는 어떻게 생겼습니까? –