class DevModeInitializer implements ClassLoaderAwareServletContainerInitializer, Serializable,
        ServletContextListener {

    @Override
    public void process(Set<Class<?>> classes, ServletContext context)
            throws ServletException {
        Collection<? extends ServletRegistration> registrations = context
                .getServletRegistrations().values();

        ServletRegistration vaadinServletRegistration = null;
        for (ServletRegistration registration : registrations) {
            if (registration.getClassName() != null
                    && isVaadinServletSubClass(registration.getClassName())) {
                vaadinServletRegistration = registration;
                break;
            }
        }

        DeploymentConfiguration config;
        if (vaadinServletRegistration != null) {
            config = StubServletConfig.createDeploymentConfiguration(context,
                    vaadinServletRegistration, VaadinServlet.class);
        } else {
            config = StubServletConfig.createDeploymentConfiguration(context,
                    VaadinServlet.class);
        }

        initDevModeHandler(classes, context, config);

        setDevModeStarted(context);
    }

}