List of usage examples for org.springframework.context ApplicationContext getBean
Object getBean(String name) throws BeansException;
From source file:edu.eci.cosw.samples.logica.ClaseMain.java
public static void main(String[] args) { ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml"); Clase c = applicationContext.getBean(Clase.class); Pedido p = c.consultarPedido(93);/*from w w w.j av a 2 s. co m*/ System.out.println("el pedodp que trae viene connnnnn " + p.getIdPedidos()); }
From source file:com.apress.prospringintegration.corespring.config.componentscan.MainComponentScan.java
public static void main(String[] args) throws Exception { ApplicationContext app = new ClassPathXmlApplicationContext("ioc_component_scan.xml"); ColorPicker cp = app.getBean(ColorPicker.class); Assert.notNull(cp);//from ww w . j a v a 2 s . com Assert.notNull(cp.getColorRandomizer()); if ((cp.getColorRandomizer() != null)) { System.out.println(cp.getColorRandomizer().exceptColor(ColorEnum.red)); } }
From source file:com.example.si.retrysample.RetryMainClass.java
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("retry-config.xml"); RetrySampleGateway gateway = context.getBean(RetrySampleGateway.class); gateway.process("payload"); }
From source file:com.mycompany.spring.context.demo.Application.java
public static void main(String[] args) { ApplicationContext context = new AnnotationConfigApplicationContext(Application.class); MessagePrinter printer = context.getBean(MessagePrinter.class); printer.printMessage();/*from www. j a v a 2 s.c om*/ }
From source file:yangqi.spring3.aop.anno.AnnoMain.java
/** * @param args/*from w w w. ja v a 2 s .com*/ */ public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("aop.xml"); Human human = (Human) context.getBean("human"); human.sleep(); Dog dog = (Dog) context.getBean("dog"); dog.sleep(); human.speak("fuck you"); }
From source file:org.robertburrelldonkin.template4couchdb.App.java
public static void main(String[] args) { ApplicationContext context = load(); @SuppressWarnings("unchecked") CouchDBTemplate<String> template = context.getBean(CouchDBTemplate.class); final StringDocumentMapper mapper = new StringDocumentMapper(); System.out.println(template.version(mapper)); System.out.println(template.post(mapper, "{\"hello\": \"world\"}")); }
From source file:org.shareok.data.plosdata.Main.java
public static void main(String[] args) throws Exception { //ApplicationContext context = new ClassPathXmlApplicationContext("classpath*:**/officeContext.xml"); ApplicationContext context = new ClassPathXmlApplicationContext("plosContext.xml"); PlosDoiData obj = (PlosDoiData) context.getBean("plosDoiData"); obj.importData("plos_articles_2.xlsx"); obj.getMetaData();/*ww w . ja va 2 s. c om*/ //ExcelHandler obj = (ExcelHandler) context.getBean("excelHandler"); //obj.setFileName("ok"); }
From source file:javaspringtest.JavaSpringTest.java
/** * @param args the command line arguments *///from w w w . j a va 2 s. c o m public static void main(String[] args) { // Triangle tri = new Triangle(); // BeanFactory factory = new XmlBeanFactory(new FileSystemResource("spring.xml")); // Triangle triObj = (Triangle) factory.getBean("triangle"); // ApplicationContext context = new ClassPathXmlApplicationContext("file:spring.xml"); // file: preffix point to file system resources, not classpath. // file path can be relative or system (/home/user/Work/src...) ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml"); Shape shape = (Shape) context.getBean("circle"); shape.draw(); // System.out.println(context.getMessage("greetings", null, "Default Greeting", null)); // key in proprity file, , default msg, location to look for }
From source file:Spring.Principal.java
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); Horario horario = (Horario) context.getBean("figura1"); System.out.println("Hora de inicio " + horario.getInicio()); System.out.println("Hora de fin " + horario.getFin()); }
From source file:com.santika.hendi.activeMQ.ProducerTest.java
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("appContext.xml"); MessageProducerBean mp = (MessageProducerBean) context.getBean("producer"); mp.sendMessage(new MessageObject("1234", "Test Message")); }