return injectModel(type, resource, getInjector(injectorName, resolver));
}
private static <T> T injectModel(Class<T> type, Resource resource, InjectorWithContext injector) {
try {
ModelProvider modelProvider = injector.getInstance(ModelProvider.class);
return modelProvider.get(type, resource);
} finally {
injector.popContextProvider();
}
}