Example usage for org.springframework.web.context.support XmlWebApplicationContext start

List of usage examples for org.springframework.web.context.support XmlWebApplicationContext start

Introduction

In this page you can find the example usage for org.springframework.web.context.support XmlWebApplicationContext start.

Prototype

@Override
    public void start() 

Source Link

Usage

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  a v  a2s .  c  om
    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;
}