List of usage examples for org.springframework.context.support ClassPathXmlApplicationContext ClassPathXmlApplicationContext
public ClassPathXmlApplicationContext(String... configLocations) throws BeansException
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();/*from ww w .ja va2 s . c o m*/ final AnnotationAction annotationAction = (AnnotationAction) context.getBean("annotationAction"); String hello = annotationAction.doSayHello("world"); System.out.println("result :" + hello); System.in.read(); }
From source file:demo.order.client.CxfApp.java
public static void main(String[] args) throws Exception { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext( new String[] { "demo/order/client/client-beansRh.xml" }); CxfApp cxf = (CxfApp) ctx.getBean("cxfApp"); MsgSender sender = (MsgSender) ctx.getBean("msgSenderClient"); MsgWrapper wrap = new MsgWrapper(); wrap.setMsg("KOKOSKO"); wrap.setQueue("queue1"); sender.sendMessage(wrap);//from ww w . java 2s . co m // cxf.sendMsg("KOKOSKO", "queue1"); // cxf.deliverMsg("queue1"); }
From source file:siia.helloworld.channel.HelloWorldExample.java
public static void main(String args[]) { String cfg = "siia/helloworld/channel/context.xml"; ApplicationContext context = new ClassPathXmlApplicationContext(cfg); MessageChannel channel = context.getBean("names", MessageChannel.class); Message<String> message = MessageBuilder.withPayload("World").build(); channel.send(message);//from w w w .jav a2 s . co m }
From source file:com.orchestrationexample.registerinfoservice.client.Client.java
public static void main(String args[]) throws Exception { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("client-context.xml"); RegisterInfoService register = (RegisterInfoService) context.getBean("registerInfoService"); System.out.println("Test (user exists) Aaa sss: result = " + register.checkPerson("ass", "sss")); System.out.println(/* ww w. j a va 2s . c om*/ "Test (user exists) Jozko Mrkvicka: result = " + register.checkPerson("Jozko", "Mrkvicka")); System.exit(0); }
From source file:com.apress.prospringintegration.jdbc.JdbcOutbound.java
public static void main(String[] args) throws Exception { ApplicationContext context = new ClassPathXmlApplicationContext("/spring/jdbc/jdbc-outbound-context.xml"); MessageChannel input = context.getBean("input", MessageChannel.class); Map<String, Object> rowMessage = new HashMap<String, Object>(); rowMessage.put("id", 3); rowMessage.put("firstname", "Mr"); rowMessage.put("lastname", "Bill"); rowMessage.put("status", 0); Message<Map<String, Object>> message = MessageBuilder.withPayload(rowMessage).build(); input.send(message);//from w ww. j a v a2 s . co m }
From source file:org.londonsburning.proxy.ProxyPrinterRunner.java
/** * @param args FileName/*from w ww . j a v a2s . c om*/ */ public static void main(final String[] args) { String applicationContext = "applicationContext.xml"; ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(applicationContext); FlagParser flagParser = (FlagParser) context.getBean("flagParser"); flagParser.setFlags(args); flagParser.parse(); ProxyPrinter printer = (ProxyPrinter) context.getBean("proxyPrinter"); printer.printProxies(flagParser); context.close(); }
From source file:com.fengduo.bee.job.support.JobRunner.java
@SuppressWarnings("resource") public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "classpath*:/spring/spring-*.xml"); context.start();//from w w w . ja v a2s .c om logger.info("JobRunner service server start !"); }
From source file:dk.teachus.backend.database.SchemaExport.java
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext( new String[] { "/dk/teachus/backend/applicationContext.xml", "/dk/teachus/backend/database/applicationContext-schemaExport.xml", }); LocalSessionFactoryBean sessionFactory = (LocalSessionFactoryBean) context.getBean("&sessionFactory"); org.hibernate.tool.hbm2ddl.SchemaExport export = new org.hibernate.tool.hbm2ddl.SchemaExport( sessionFactory.getConfiguration()); export.setOutputFile("target/schema.sql"); export.execute(false, false, false, true); System.exit(0);/*from w w w.j a v a 2 s. c o m*/ }
From source file:demo.spring.client.Client.java
public static void main(String args[]) throws Exception { // START SNIPPET: client ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( new String[] { "client-beans.xml" }); HelloWorld client = (HelloWorld) context.getBean("client"); String response = client.sayHi("Joe"); System.out.println("Response: " + response); System.exit(0);/*from ww w.jav a2 s . c o m*/ // END SNIPPET: client }
From source file:com.alibaba.dubbo.examples.cache.CacheConsumer.java
public static void main(String[] args) throws Exception { String config = CacheConsumer.class.getPackage().getName().replace('.', '/') + "/cache-consumer.xml"; ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config); context.start();// w w w . java2s . c om CacheService cacheService = (CacheService) context.getBean("cacheService"); // ?(?) String fix = null; for (int i = 0; i < 5; i++) { String result = cacheService.findCache("0"); if (fix == null || fix.equals(result)) { System.out.println("OK: " + result); } else { System.err.println("ERROR: " + result); } fix = result; Thread.sleep(500); } // LRU?cache.size10001001 for (int n = 0; n < 1001; n++) { String pre = null; for (int i = 0; i < 10; i++) { String result = cacheService.findCache(String.valueOf(n)); if (pre != null && !pre.equals(result)) { System.err.println("ERROR: " + result); } pre = result; } } // LRU String result = cacheService.findCache("0"); System.out.println("OK--->: " + result); if (fix != null && !fix.equals(result)) { System.out.println("OK: " + result); } else { System.err.println("ERROR: " + result); } }