List of usage examples for org.springframework.web.context.support XmlWebApplicationContext getBeansOfType
@Override
public <T> Map<String, T> getBeansOfType(@Nullable Class<T> type) throws BeansException
From source file:com.predic8.membrane.servlet.RouterUtil.java
public static Router initializeRoutersFromSpringWebContext(XmlWebApplicationContext appCtx, final ServletContext ctx, String configLocation) { appCtx.setServletContext(ctx);/*from w w w . j ava 2 s . c o m*/ appCtx.setConfigLocation(configLocation); appCtx.refresh(); Collection<Router> routers = appCtx.getBeansOfType(Router.class).values(); Router theOne = null; for (Router r : routers) { r.getResolverMap().addSchemaResolver(new FileSchemaWebAppResolver(ctx)); if (r.getTransport() instanceof ServletTransport) { if (theOne != null) throw new RuntimeException("Only one <router> may have a <servletTransport> defined."); theOne = r; } } appCtx.start(); return theOne; }