/** * Callback for destruction of this instance, originally attached * to a {@code DisposableBean} implementation (not anymore in 5.0). * <p>The {@link #close()} method is the native way to shut down * an ApplicationContext, which this method simply delegates to. * @deprecated as of Spring Framework 5.0, in favor of {@link #close()} */ @Deprecated public void destroy() { close(); }
/** * Callback for destruction of this instance, originally attached * to a {@code DisposableBean} implementation (not anymore in 5.0). * <p>The {@link #close()} method is the native way to shut down * an ApplicationContext, which this method simply delegates to. * @deprecated as of Spring Framework 5.0, in favor of {@link #close()} */ @Deprecated public void destroy() { close(); }
public static void main(String[] args) throws InterruptedException, IOException { AbstractApplicationContext context = new ClassPathXmlApplicationContext( "/META-INF/spring/integration/activemq/cafeDemo-amq-config.xml", "/META-INF/spring/integration/activemq/cafeDemo-amq-baristaCold-xml.xml"); System.out.println("Press Enter/Return to exit"); System.in.read(); context.close(); }
public static void main(String[] args) throws InterruptedException, IOException { AbstractApplicationContext context = new ClassPathXmlApplicationContext( "/META-INF/spring/integration/activemq/cafeDemo-amq-config.xml", "/META-INF/spring/integration/activemq/cafeDemo-amq-operations.xml"); System.out.println("Press Enter/Return to exit"); System.in.read(); context.close(); } }
public static void main(String[] args) throws InterruptedException, IOException { AbstractApplicationContext context = new ClassPathXmlApplicationContext( "/META-INF/spring/integration/activemq/cafeDemo-amq-config.xml", "/META-INF/spring/integration/activemq/cafeDemo-amq-baristaHot-xml.xml"); System.out.println("Press Enter/Return to exit"); System.in.read(); context.close(); } }
@Override public void run() { try { applicationContext.close(); LOGGER.info("ApplicationContext " + applicationContext + " is closed."); } catch (Exception e) { LOGGER.error("Failed to close ApplicationContext", e); } try { LOCK.lock(); STOP.signal(); } finally { LOCK.unlock(); } } }));
public static void main(String[] args) { AbstractApplicationContext context = CafeDemoAppUtilities.loadProfileContext( "/META-INF/spring/integration/amqp/cafeDemo-amqp-baristaHot-xml.xml", CafeDemoAppBaristaHotAmqp.class,CafeDemoAppUtilities.DEV); System.out.println("Press Enter/Return in the console to exit the Barista Hot App"); try { System.in.read(); } catch (IOException e) { context.close(); } context.close(); } }
public static void main(String[] args) { AbstractApplicationContext context = CafeDemoAppUtilities.loadProfileContext( "/META-INF/spring/integration/amqp/cafeDemo-amqp-operations-xml.xml", CafeDemoAppOperationsAmqp.class,CafeDemoAppUtilities.DEV); System.out.println("Press Enter/Return in the console to exit the Cafe Operations App"); try { System.in.read(); } catch (IOException e) { context.close(); } context.close(); } }
public static void main(String[] args) { AbstractApplicationContext context = CafeDemoAppUtilities.loadProfileContext( "/META-INF/spring/integration/amqp/cafeDemo-amqp-baristaCold-xml.xml", CafeDemoAppBaristaColdAmqp.class,CafeDemoAppUtilities.DEV); System.out.println("Press Enter/Return in the console to exit the Barista Cold App"); try { System.in.read(); } catch (IOException e) { context.close(); } context.close(); } }
@Override public void close() { logger.info("### Shutdown initiated ### "); ((AbstractApplicationContext) getApplicationContext()).close(); }
public static void main(String[] args) throws InterruptedException, IOException { AbstractApplicationContext context = new ClassPathXmlApplicationContext( "/META-INF/spring/integration/activemq/cafeDemo-amq-config.xml", "/META-INF/spring/integration/activemq/cafeDemo-amq-xml.xml"); order(context, 25); context.close(); } }
public static void main(String[] args) throws InterruptedException, IOException { AbstractApplicationContext context = new ClassPathXmlApplicationContext( "/META-INF/spring/integration/activemq/cafeDemo-amq-config.xml", "/META-INF/spring/integration/activemq/cafeDemo-amq-jms-backed.xml"); // comment this out to run the sample without placing any new orders on the queue order(context, 25); System.in.read(); context.close(); } }
public static void main(String[] args) throws Exception { AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext("/META-INF/spring/integration/orderProcessingSample.xml", BookOrderProcessingTestApp.class); MessageChannel messageChannel = (MessageChannel) applicationContext.getBean("ordersChannel"); GenericMessage<Document> orderMessage = createXmlMessageFromResource("META-INF/spring/integration/order.xml"); messageChannel.send(orderMessage); applicationContext.close(); }
public static void main(String[] args) throws Exception { AbstractApplicationContext context = new ClassPathXmlApplicationContext( "META-INF/spring/integration/04-externalgateway/*.xml"); System.out.println("Please enter zip"); BufferedReader console = new BufferedReader(new InputStreamReader(System.in)); String line = console.readLine(); if (line != null) { String zip = line.trim(); WeatherAndTraffic weatherAndTraffic = context.getBean("wat", WeatherAndTraffic.class); List<String> result = weatherAndTraffic.getByZip(zip); System.out.println(result.get(0) + "\r\n" + result.get(1) + "\r\n"); } else { System.out.println("Console closed"); } context.close(); System.exit(0); } }
public static void main(String[] args) throws Exception { LOGGER.info("\n=========================================================" + "\n " + "\n Welcome to Spring Integration! " + "\n " + "\n For more information please visit: " + "\n http://www.springsource.org/spring-integration " + "\n " + "\n=========================================================" ); final AbstractApplicationContext context = new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/stateless-retry-advice-context.xml"); context.registerShutdownHook(); LOGGER.info("\n=========================================================" + "\n " + "\n This is the Stateless Sample - " + "\n " + "\n Please enter some text and press return. " + "\n 'fail 2' will fail twice, then succeed " + "\n 'fail 3' will fail and never succeed " + "\n Demo will terminate in 60 seconds. " + "\n " + "\n=========================================================" ); Thread.sleep(60000); context.close(); }
public static void main(String[] args) { AbstractApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/spring/integration/helloWorldDemo.xml", HelloWorldApp.class); MessageChannel inputChannel = context.getBean("inputChannel", MessageChannel.class); PollableChannel outputChannel = context.getBean("outputChannel", PollableChannel.class); inputChannel.send(new GenericMessage<String>("World")); logger.info("==> HelloWorldDemo: " + outputChannel.receive(0).getPayload()); context.close(); }
public static void main(String[] args) { AbstractApplicationContext context = CafeDemoAppUtilities.loadProfileContext( "/META-INF/spring/integration/amqp/cafeDemo-amqp-xml.xml", CafeDemoAppAmqp.class,CafeDemoAppUtilities.DEV); order(context, 100); context.close(); } }
public static void main(String[] args) { AbstractApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/spring/integration/cafeDemo-control-bus.xml"); WaiterMonitor waiterMonitor = (WaiterMonitor) context.getBean("waiterMonitor"); int totalDeliveries = 0; while (totalDeliveries <= 3) { try { Thread.sleep(1000); } catch (InterruptedException e) { logger.error("Interrupted", e); } totalDeliveries = (Integer)waiterMonitor.sendControlScript("waiter.totalDeliveries"); logger.info("Total cafe deliveries: " + totalDeliveries); if (totalDeliveries > 3) { logger.info("stopping orders..."); waiterMonitor.sendControlScript("cafe.stop()"); logger.info("orders stopped"); } } context.close(); System.exit(0); }
public static void main(String[] args) { AbstractApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/spring/integration/cafeDemo-annotation.xml", CafeDemoApp.class); Cafe cafe = (Cafe) context.getBean("cafe"); for (int i = 1; i <= 100; i++) { Order order = new Order(i); order.addItem(DrinkType.LATTE, 2, false); order.addItem(DrinkType.MOCHA, 3, true); cafe.placeOrder(order); } context.close(); } }
public static void main(String[] args) { AbstractApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/spring/integration/cafeDemo-xml.xml", CafeDemoApp.class); Cafe cafe = (Cafe) context.getBean("cafe"); for (int i = 1; i <= 100; i++) { Order order = new Order(i); order.addItem(DrinkType.LATTE, 2, false); order.addItem(DrinkType.MOCHA, 3, true); cafe.placeOrder(order); } context.close(); } }