use of com.googlecode.gwt.test.exceptions.GwtTestConfigurationException in project gwt-test-utils by gwt-test-utils.
the class GwtGuiceHelper method getInjector.
public Injector getInjector() {
if (this.injector == null && !hasSearchedInjector) {
for (String listenerClassName : WebXmlUtils.get().getListenerClasses()) {
try {
Class<?> clazz = GwtReflectionUtils.getClass(listenerClassName);
if (GuiceServletContextListener.class.isAssignableFrom(clazz)) {
Object instance = GwtReflectionUtils.instantiateClass(clazz);
this.injector = GwtReflectionUtils.callPrivateMethod(instance, "getInjector");
}
} catch (Exception e) {
throw new GwtTestConfigurationException("Error while parsing web.xml searching for a Guice Injector in a configured GuiceServletContextListener", e);
}
}
hasSearchedInjector = true;
}
// can be null
return this.injector;
}
Aggregations