public static Ethereum createEthereum(Class ... springConfigs) { logger.info("Starting EthereumJ..."); AbstractApplicationContext context = new AnnotationConfigApplicationContext(springConfigs); context.registerShutdownHook(); return context.getBean(Ethereum.class); } }
new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/spring-integration-context.xml"); context.registerShutdownHook();
new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/spring-integration-confirms-context.xml"); context.registerShutdownHook();
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/stateful-retry-advice-context.xml"); context.registerShutdownHook(); LOGGER.info("\n=========================================================" + "\n " + "\n This is the Stateful 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) 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) 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/circuit-breaker-advice-context.xml"); context.registerShutdownHook(); LOGGER.info("\n=========================================================" + "\n " + "\n This is the Circuit Breaker Sample - " + "\n " + "\n Please enter some text and press return a few times. " + "\n Service will succeed only in the last quarter " + "\n minute. Breaker will open after 2 failures and " + "\n will go half-open after 15 seconds. " + "\n Demo will terminate in 2 minutes. " + "\n " + "\n=========================================================" ); Thread.sleep(120000); context.close(); }
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/transaction-synch-context.xml"); context.registerShutdownHook(); LOGGER.info("\n=========================================================" + "\n " + "\n This is the Transaction Synchronization Sample - " + "\n " + "\n Press 'Enter' to terminate. " + "\n " + "\n Place a file in " + System.getProperty("java.io.tmpdir") + "/txSynchDemo ending " + "\n with .txt " + "\n If the first line begins with 'fail' the transaction " + "\n transaction will be rolled back.The result of the " + "\n expression evaluation is logged. " + "\n " + "\n=========================================================" ); System.out.println(System.getProperty("java.io.tmpdir") + "/txSynchDemo"); System.in.read(); context.close(); }
new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/*-context.xml"); context.registerShutdownHook();
"classpath:META-INF/spring/integration/*-context.xml"); context.registerShutdownHook();
new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/*-context.xml"); context.registerShutdownHook();
new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/*-context.xml"); context.registerShutdownHook();
"classpath:META-INF/spring/integration/*-context.xml"); context.registerShutdownHook();
new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/*-context.xml"); context.registerShutdownHook();
new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/expression-advice-context.xml"); context.registerShutdownHook();
new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/expression-advice-context.xml"); context.registerShutdownHook();
new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/*-context.xml"); context.registerShutdownHook();
new ClassPathXmlApplicationContext("classpath:META-INF/spring/integration/*-context.xml"); context.registerShutdownHook();
@Override public void onApplicationEvent(ApplicationEvent event) { if (initEventClass.isInstance(event)) { if (applicationContext instanceof AbstractApplicationContext) { ((AbstractApplicationContext) applicationContext).registerShutdownHook(); } if (SCBEngine.getInstance().getBootListenerList() == null) { //SCBEngine init first, hence we do not need worry that when other beans need use the //producer microserviceMeta, the SCBEngine is not inited. String serviceName = RegistryUtils.getMicroservice().getServiceName(); SCBEngine.getInstance().setProducerMicroserviceMeta(new MicroserviceMeta(serviceName)); SCBEngine.getInstance().setProducerProviderManager(applicationContext.getBean(ProducerProviderManager.class)); SCBEngine.getInstance().setConsumerProviderManager(applicationContext.getBean(ConsumerProviderManager.class)); SCBEngine.getInstance().setTransportManager(applicationContext.getBean(TransportManager.class)); SCBEngine.getInstance().setSchemaListenerManager(applicationContext.getBean(SchemaListenerManager.class)); SCBEngine.getInstance().setBootListenerList(applicationContext.getBeansOfType(BootListener.class).values()); SCBEngine.getInstance().setStaticSchemaFactory(applicationContext.getBean(StaticSchemaFactory.class)); } SCBEngine.getInstance().init(); } else if (event instanceof ContextClosedEvent) { SCBEngine.getInstance().destroy(); } } }
public static void main(String[] args) { log.info(">>>>> goodsKill-rpc-service 正在启动 <<<<<"); AbstractApplicationContext context= new ClassPathXmlApplicationContext( "classpath*:META-INF/spring/spring-*.xml"); // 程序退出前优雅关闭JVM context.registerShutdownHook(); context.start(); log.info(">>>>> goodsKill-rpc-service 启动完成 <<<<<"); }
public static void main(String[] args) { context = new AnnotationConfigApplicationContext(AppConfig.class); context.registerShutdownHook(); new CollectionCommanderStarter().start(); context.close(); }