I noticed that if you define a bean with same id in two xml files, it would be overiden in the second file.
Say in file a.xml i have
Also:
final ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(); ctx.setAllowBeanDefinitionOverriding(false); ctx.setConfigLocations(shardContextImport); ctx.setParent(refreshedEvent.getApplicationContext()); ctx.refresh();