The best way I could find is this: just override bindInterceptor methods like this.
Matcher:
public final class NoSyntheticMethodMatcher extends AbstractMatcher<Method> {
public static final NoSyntheticMethodMatcher INSTANCE = new NoSyntheticMethodMatcher();
private NoSyntheticMethodMatcher() {}
@Override
public boolean matches(Method method) {
return !method.isSynthetic();
}
}
BindInterceptor method:
@Override
protected void bindInterceptor(Matcher<? super Class<?>> classMatcher, Matcher<? super Method> methodMatcher, MethodInterceptor... interceptors) {
super.bindInterceptor(classMatcher, NoSyntheticMethodMatcher.INSTANCE.and(methodMatcher), interceptors);
}
But the solution does not always work. As in my case, the target JpaPersistModule is final, and the only way I could override the method is to copy the inserted implementation.
source
share