/** * Get the application class from the bean configured in Spring's context. * * @see AbstractApplicationServlet#getApplicationClass() */ @Override protected Class<? extends Application> getApplicationClass() throws ClassNotFoundException { WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(getServletContext()); if (wac == null) { throw new ClassNotFoundException( "Cannot get an handle on Spring's context. Is Spring running? " + "Check there's an org.springframework.web.context.ContextLoaderListener configured."); } String[] beanDefinitionNames = wac.getBeanDefinitionNames(); for (String string : beanDefinitionNames) { System.out.println("SpringApplicationServlet.getApplicationClass() " + string); } Application bean = wac.getBean(name, Application.class); if (bean == null) { throw new ClassNotFoundException("No application bean found under name " + name); } return bean.getClass(); }