Method method = findTargetMethod(controller, scope);
if (method == null) {
throw new IllegalStateException("Cannot find handler for operation on " + controller.getClass());
}
MethodInvoker invoker = invokerProvider.get();
if (scope != null) {
invoker.addProvider(new Function<Class<?>, Object>() {
@Override
public Object apply(Class<?> clazz) {
return scope.getInstance(clazz);
}
});
}
invoker.invokeMethod(controller, method);
}