use of com.vaadin.flow.di.LookupInitializer in project flow by vaadin.
the class LookupServletContainerInitializer method getLookupInitializer.
private AbstractLookupInitializer getLookupInitializer(Map<Class<?>, Collection<Class<?>>> services) throws ServletException {
Collection<Class<?>> initializers = services.remove(AbstractLookupInitializer.class);
if (initializers == null) {
initializers = Collections.emptyList();
} else {
initializers.remove(LookupInitializer.class);
}
AbstractLookupInitializer initializer;
if (initializers.isEmpty()) {
initializer = new LookupInitializer();
} else if (initializers.size() > 1) {
throw new ServletException("Several implementation of " + AbstractLookupInitializer.class.getSimpleName() + " are found in the claspath: " + initializers);
} else {
initializer = AbstractLookupInitializer.class.cast(ReflectTools.createInstance(initializers.iterator().next()));
}
return initializer;
}
Aggregations