The best way I could find is the following: just override the 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();
}
}
The 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 doesn't always work. Like in my case, the target JpaPersistModule is final and the only way I could override the method is to copy pasted the implementation.