List of usage examples for org.springframework.context.support ClassPathXmlApplicationContext setId
@Override public void setId(String id)
From source file:org.cleverbus.core.common.extension.AbstractExtensionConfigurationLoader.java
private void loadExtension(String extConfigLocation, int extNumber) throws Exception { Log.debug("new extension context for '" + extConfigLocation + "' started ..."); ClassPathXmlApplicationContext extContext = new ClassPathXmlApplicationContext(parentContext); extContext.setId("CleverBus extension nr. " + extNumber); extContext.setDisplayName("CleverBus extension context for '" + extConfigLocation + '"'); extContext.setConfigLocation(extConfigLocation); extContext.refresh();/*www . j a v a2s . com*/ // add routes into Camel context if (isAutoRouteAdding()) { Map<String, AbstractExtRoute> beansOfType = extContext.getBeansOfType(AbstractExtRoute.class); for (Map.Entry<String, AbstractExtRoute> entry : beansOfType.entrySet()) { AbstractExtRoute route = entry.getValue(); // note: route with existing route ID will override the previous one // it's not possible automatically change route ID before adding to Camel context camelContext.addRoutes(route); } } Log.debug("new extension context for '" + extConfigLocation + "' was successfully created"); }
From source file:guru.qas.martini.jmeter.config.DefaultApplicationContextBuilder.java
protected ConfigurableApplicationContext build(String[] locations) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(locations, false); setProfiles(context);//from w ww. j a v a 2 s. c o m setEnvironment(context); String id = new AlternativeJdkIdGenerator().generateId().toString(); context.setId(id); context.refresh(); return context; }