List of usage examples for org.springframework.context ApplicationContext getBean
Object getBean(String name) throws BeansException;
From source file:com.engine.test.Starter.java
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("pipelineConfig.xml"); PipelineManager pipeline = (PipelineManager) context.getBean(PipelineManager.class); String[] docArray = { "This is doc 1", "Another document" }; for (String doc : docArray) { InputDocument in = new InputDocument(); in.setCnt(doc);/* w w w .j a va 2 s . c o m*/ pipeline.doAction(in); } }
From source file:org.dcache.xdr.SpringRunner.java
public static void main(String[] args) throws IOException { if (args.length != 1) { System.err.println("Usage: SpringRunner <config>"); System.exit(1);/*from www . j av a 2s . c o m*/ } try { ApplicationContext context = new FileSystemXmlApplicationContext(args[0]); OncRpcSvc service = (OncRpcSvc) context.getBean("oncrpcsvc"); service.start(); System.in.read(); } catch (BeansException e) { System.err.println("Spring: " + e.getMessage()); System.exit(1); } }
From source file:$.Sprodion.java
/** * @param args the command line arguments * @throws java.lang.Exception/* ww w. j a v a 2s. c o m*/ */ public static void main(final String[] args) throws Exception { ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); Sprodion s = context.getBean(Sprodion.class); s.hello(); Dummy entity = new Dummy(); entity.setAmount(10); entity.setName("Hello hibernate!"); DummyDao dao = s.getDao(); dao.create(entity); List<Dummy> entities = dao.findAll(); for (Dummy iter : entities) { System.out.println(iter.getName()); } }
From source file:com.apress.prospringintegration.ip.UdpMulticast.java
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("spring/ip/udp-multicast.xml"); MessageChannel messageChannel = (MessageChannel) context.getBean("sendUdp"); messageChannel.send(MessageBuilder.withPayload("Testing UDP").build()); }
From source file:lab.home.spring.redis.test.SpringRedisTest.java
public static void main(String argv[]) { ApplicationContext ctx = new AnnotationConfigApplicationContext(RedisTestConfig.class); DictionaryDao ddao = ctx.getBean(DictionaryDao.class); try {//from w ww. j ava 2 s . c o m System.out.println("ddao.setValue(\"key1\", \"value1\")"); ddao.setValue("key1", "value1"); System.out.println("ddao.setValue(\"testkey\", \"testvalue\")"); ddao.setValue("testkey", "testvalue"); System.out.println("getting value for key1 = " + ddao.getValue("key1")); System.out.println("getting value for testkey = " + ddao.getValue("testkey")); } catch (Exception e) { System.out.println(e); System.out.println(e.fillInStackTrace()); System.out.println(e.getCause()); System.out.println(e.getClass()); System.out.println(e.getStackTrace()); e.printStackTrace(); } }
From source file:siia.business.NotificationDemo.java
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("notificationPublisher.xml"); FlightStatusNotificationPublisher publisher = context.getBean(FlightStatusNotificationPublisher.class); FlightStatusEvent event = new FlightStatusEvent(); publisher.publishNotification(event); }
From source file:org.freewheelschedule.freewheel.schedule.ScheduleLauncher.java
public static void main(String[] args) { ApplicationContext ctx = new AnnotationConfigApplicationContext(ServerConfig.class); ScheduleLauncher server = (ScheduleLauncher) ctx.getBean("scheduleLauncher"); server.runScheduleLauncher();// ww w.j av a 2s .c o m }
From source file:com.anton.dev.tqrbs2.QueueConsumeProcess.java
public static void main(String[] argv) throws Exception { ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); QueueConsumeProcess consumer = context.getBean(QueueConsumeProcess.class); consumer.consume();//from w w w .j av a 2 s .co m }
From source file:freylis.shapes.shapes.Shapes.java
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); Shapes shapes = (Shapes) context.getBean("shapesRunner"); shapes.runShapes();/*w w w .ja v a 2s .c om*/ }
From source file:pkg.ConstructorBasedDIMain.java
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml"); ConstructorBasedDITextEditor te = (ConstructorBasedDITextEditor) context.getBean("textEditor"); te.spellCheck();/* w ww .jav a 2 s . co m*/ // output order: /* Inside SpellChecker constructor. Inside setSpellChecker. Inside checkSpelling. */ }