protected void initXmlApplicationContext(
     AcServiceConfig serviceConfig, boolean autoScan, Resource... configResources) {
   GenericXmlApplicationContext xmlContext = new GenericXmlApplicationContext();
   appContext = xmlContext;
   xmlContext.setParent(prepareParentContext(serviceConfig));
   xmlContext.load(configResources);
   if (autoScan) {
     ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(xmlContext);
     // scan this package from provider hosting
     scanner.scan(this.getClass().getPackage().getName());
   }
   postSetupApplicationContext(appContext, serviceConfig);
   appContext.refresh();
 }
  public static void main(String[] args) {
    GenericXmlApplicationContext parent = new GenericXmlApplicationContext();
    parent.load("classpath:META-INF/spring/parent.xml");
    parent.refresh();

    GenericXmlApplicationContext child = new GenericXmlApplicationContext();
    child.load("classpath:META-INF/spring/app-context-xml.xml");
    child.setParent(parent);
    child.refresh();

    SimpleTarget target1 = (SimpleTarget) child.getBean("target1");
    SimpleTarget target2 = (SimpleTarget) child.getBean("target2");
    SimpleTarget target3 = (SimpleTarget) child.getBean("target3");

    System.out.println(target1.getVal());
    System.out.println(target2.getVal());
    System.out.println(target3.getVal());
  }