class Tavern {

    public void init() throws IOException {
        Enumeration<URL> resources = getClass().getClassLoader().getResources("app.xml");
        while (resources.hasMoreElements()) {
            URL url = resources.nextElement();
            URLConnection urlConnection = url.openConnection();
            urlConnection.connect();
            ApplicationConfig config = parser.parse(urlConnection.getInputStream());
            Assert.notNull(config.getName(), "Name of application must not be null!");
            Application application = new Application(config, ResourceUtils.extractJarFileURL(url).toString());
            tavernApplicationContainer.register(application);
            applicationList.add(application);
        }
        ApplicationConfig globalConfig = new ApplicationConfig();
        globalConfig.setName(GLOBAL_APPLICATION);
        Application globalApplication = new Application(globalConfig, null);
        globalApplication.setRoot(true);
        tavernApplicationContainer.register(globalApplication);
        applicationList.add(globalApplication);
        for (Application application : applicationList) {
            PluginContext pluginContext = new PluginContext(application, tavernApplicationContainer, servletContext);
            for (TavernPlugin plugin : plugins) {
                plugin.init(pluginContext);
            }
        }
    }

}