List of usage examples for org.springframework.beans.factory.config PropertyOverrideConfigurer setBeanNameSeparator
public void setBeanNameSeparator(String beanNameSeparator)
From source file:org.sakaiproject.component.cover.TestComponentManagerContainer.java
/** * create a component manager based on a list of component.xml * @param configPaths a ';' seperated list of xml bean config files * @throws IOException/* w w w. jav a 2s .c o m*/ */ public TestComponentManagerContainer(String configPaths, Properties props) throws IOException { // we assume that all the jars are in the same classloader, so this will // not check for // incorrect bindings and will not fully replicate the tomcat // experience, but is an easier environment // to work within for kernel testing. // For a more complex structure we could use the kernel poms in the repo // to generate the dep list. if (ComponentManager.m_componentManager != null) { log.info("Closing existing Component Manager "); /* try { ComponentManager.m_componentManager.close(); } catch ( Throwable t ) { log.warn("Close Failed with message, safe to ignore "+t.getMessage()); } */ log.info("Closing Complete "); ComponentManager.m_componentManager = null; } log.info("Starting Component Manager with [" + configPaths + "]"); ComponentManager.setLateRefresh(true); componentManager = (SpringCompMgr) ComponentManager.getInstance(); ConfigurableApplicationContext ac = componentManager.getApplicationContext(); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); // Supply any additional configuration. if (props != null) { PropertyOverrideConfigurer beanFactoryPostProcessor = new PropertyOverrideConfigurer(); beanFactoryPostProcessor.setBeanNameSeparator("@"); beanFactoryPostProcessor.setProperties(props); ac.addBeanFactoryPostProcessor(beanFactoryPostProcessor); } // we could take the kernel bootstrap from from the classpath in future // rather than from // the filesystem List<Resource> config = new ArrayList<Resource>(); String[] configPath = configPaths.split(";"); for (String p : configPath) { File xml = new File(p); config.add(new FileSystemResource(xml.getCanonicalPath())); } loadComponent(ac, config, classLoader); ac.refresh(); // SAK-20908 - band-aid for TLM sync issues causing tests to fail // This sleep shouldn't be needed but it seems these tests are starting before ThreadLocalManager has finished its startup. try { Thread.sleep(500); // 1/2 second log.debug("Finished starting the component manager"); } catch (InterruptedException e) { log.error("Component manager startup interrupted..."); } }