List of usage examples for org.springframework.context.support ClassPathXmlApplicationContext start
@Override public void start()
From source file:com.alibaba.dubbo.examples.generic.GenericConsumer.java
public static void main(String[] args) throws Exception { String config = GenericConsumer.class.getPackage().getName().replace('.', '/') + "/generic-consumer.xml"; ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config); context.start(); IUserService userservice = (IUserService) context.getBean("userservice"); User user = userservice.get(new Params("a=b")); System.out.println(user);//w ww .j a va 2 s . c om System.in.read(); }
From source file:com.alibaba.dubbo.examples.annotation.AnnotationConsumer.java
public static void main(String[] args) throws Exception { String config = AnnotationConsumer.class.getPackage().getName().replace('.', '/') + "/annotation-consumer.xml"; ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config); context.start(); final AnnotationAction annotationAction = (AnnotationAction) context.getBean("annotationAction"); String hello = annotationAction.doSayHello("world"); System.out.println("result :" + hello); System.in.read();//from w w w .j a v a2 s . co m }
From source file:com.apress.prospringintegration.adapters.Main.java
public static void main(String[] args) { ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("adapters.xml"); applicationContext.start(); }
From source file:com.apress.prospringintegration.messaging.activemq.jms.adapter.TicketReceiverMain.java
public static void main(String[] args) { String contextName = "ticket-receiver.xml"; ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(contextName); applicationContext.start(); }
From source file:com.alibaba.dubbo.examples.version.VersionConsumer.java
public static void main(String[] args) throws Exception { String config = VersionConsumer.class.getPackage().getName().replace('.', '/') + "/version-consumer.xml"; ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config); context.start(); VersionService versionService = (VersionService) context.getBean("versionService"); for (int i = 0; i < 10000; i++) { String hello = versionService.sayHello("world"); System.out.println(hello); Thread.sleep(2000);//w ww. j av a 2 s .c om } System.in.read(); }
From source file:edu.berkeley.path.next.persistService.persistServiceApp.java
public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("persist-service.xml"); context.start(); }
From source file:com.alibaba.dubbo.examples.callback.CallbackConsumer.java
public static void main(String[] args) throws Exception { String config = CallbackConsumer.class.getPackage().getName().replace('.', '/') + "/callback-consumer.xml"; ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config); context.start(); CallbackService callbackService = (CallbackService) context.getBean("callbackService"); callbackService.addListener("foo.bar", new CallbackListener() { public void changed(String msg) { System.out.println("callback1:" + msg); }/*ww w . ja va2 s . c om*/ }); System.in.read(); }
From source file:com.bow.rest.RestConsumer.java
public static void main(String[] args) throws Exception { String config = RestConsumer.class.getPackage().getName().replace('.', '/') + "/rest-consumer.xml"; ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config); context.start(); AnotherUserRestService userService = (AnotherUserRestService) context.getBean("anotherUserRestService"); User user = new User(1L, "larrypage"); System.out.println("SUCCESS: registered user with id " + userService.registerUser(user).getId()); RpcContext.getContext().setAttachment("clientName", "demo"); RpcContext.getContext().setAttachment("clientImpl", "dubbox"); System.out.println("SUCCESS: got user " + userService.getUser(1L)); System.in.read();//from w ww. ja v a 2s .c om }
From source file:edu.berkeley.path.next.modelEngine.modeEngineApp.java
public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("modelEngine-subscribe.xml"); context.start(); }
From source file:com.alibaba.dubbo.examples.merge.MergeConsumer.java
public static void main(String[] args) throws Exception { String config = MergeConsumer.class.getPackage().getName().replace('.', '/') + "/merge-consumer.xml"; ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config); context.start(); MergeService mergeService = (MergeService) context.getBean("mergeService"); for (int i = 0; i < Integer.MAX_VALUE; i++) { try {/*from w w w.ja v a 2s .co m*/ List<String> result = mergeService.mergeResult(); System.out.println("(" + i + ") " + result); Thread.sleep(1000); } catch (Exception e) { e.printStackTrace(); } } }