Examples of registerShutdownHook()


Examples of org.springframework.context.support.GenericApplicationContext.registerShutdownHook()

        // copy BeanPostProcessors to the child context
        for (String bppName : context.getBeanFactory().getBeanNamesForType(BeanPostProcessor.class)) {
            gac.registerBeanDefinition(bppName, context.getBeanFactory().getBeanDefinition(bppName));
        }
        gac.refresh();
        gac.registerShutdownHook();

        return gac;
    }

}
View Full Code Here

Examples of org.springframework.context.support.GenericXmlApplicationContext.registerShutdownHook()

        System.out.print("Enter you choice: ");
      }
    }

    context.load("classpath:META-INF/spring/integration/*-context.xml");
    context.registerShutdownHook();
    context.refresh();

    final PersonService personService = context.getBean(PersonService.class);

    System.out.println("Please enter a choice and press <enter>: ");
View Full Code Here

Examples of org.springframework.context.support.GenericXmlApplicationContext.registerShutdownHook()

    context.getEnvironment().getPropertySources().addLast(propertySource);

    System.out.println("using port " + context.getEnvironment().getProperty("availableServerSocket"));

    context.load("classpath:META-INF/spring/integration/tcpClientServerDemo-context.xml");
    context.registerShutdownHook();
    context.refresh();

    return context;
  }
}
View Full Code Here

Examples of org.springframework.context.support.GenericXmlApplicationContext.registerShutdownHook()

    final Scanner scanner = new Scanner(System.in);

    final GenericXmlApplicationContext context = new GenericXmlApplicationContext();
    context.load("classpath:META-INF/spring/integration/spring-integration-sample1-context.xml");
    context.registerShutdownHook();
    context.refresh();

    final StringConversionService service = context.getBean(StringConversionService.class);

    final String message =
View Full Code Here

Examples of org.springframework.context.support.GenericXmlApplicationContext.registerShutdownHook()

    final Scanner scanner = new Scanner(System.in);

    final GenericXmlApplicationContext context = new GenericXmlApplicationContext();
    context.load("classpath:META-INF/spring/integration/spring-integration-sample2-context.xml");
    context.registerShutdownHook();
    context.refresh();

    final CoffeeService service = context.getBean(CoffeeService.class);

    final String message = "\n\n" +
View Full Code Here

Examples of org.springframework.context.support.GenericXmlApplicationContext.registerShutdownHook()

        System.out.print("Enter you choice: ");
      }
    }

    context.load("classpath:META-INF/spring/integration/*-context.xml");
    context.registerShutdownHook();
    context.refresh();

    final ConnectionBroker connectionBroker = context.getBean(ConnectionBroker.class);

    if (LOGGER.isInfoEnabled()) {
View Full Code Here

Examples of org.springframework.context.support.GenericXmlApplicationContext.registerShutdownHook()

  @Test
  public void testMultiThreadedBatch() throws Exception {
    GenericXmlApplicationContext ctx = new GenericXmlApplicationContext(
        "/org/springframework/data/hadoop/batch/multi-thread.xml");

    ctx.registerShutdownHook();

    JobsTrigger.startJobs(ctx);
  }

  @Test
View Full Code Here

Examples of org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext.registerShutdownHook()

    public static OsgiBundleXmlApplicationContext getOsgiSpringContext(ReleaseId releaseId, URL kModuleUrl) {
        OsgiBundleXmlApplicationContext context = new OsgiBundleXmlApplicationContext(new String[] { kModuleUrl.toExternalForm() } );
        OsgiKModuleBeanFactoryPostProcessor beanFactoryPostProcessor = new OsgiKModuleBeanFactoryPostProcessor(kModuleUrl, context);
        beanFactoryPostProcessor.setReleaseId(releaseId);
        context.addBeanFactoryPostProcessor(beanFactoryPostProcessor);
        context.registerShutdownHook();
        return context;
    }

}
View Full Code Here

Examples of org.springframework.web.context.support.AnnotationConfigWebApplicationContext.registerShutdownHook()

        //the real main app context has a link to the parent context
        ctx.setParent(parent);
        ctx.register(MyAppSpringConfiguration.class);
        ctx.refresh();
        ctx.registerShutdownHook();
        ctx.start();

        //now that Spring is started, let's get all the beans that matter into DropWizard

        //health checks
View Full Code Here

Examples of org.springframework.web.context.support.GenericWebApplicationContext.registerShutdownHook()

    customizeBeanFactory(context.getDefaultListableBeanFactory(), webMergedConfig);
    loadBeanDefinitions(context, webMergedConfig);
    AnnotationConfigUtils.registerAnnotationConfigProcessors(context);
    customizeContext(context, webMergedConfig);
    context.refresh();
    context.registerShutdownHook();
    return context;
  }

  /**
   * Validate the supplied {@link WebMergedContextConfiguration} with respect to
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.