List of usage examples for org.springframework.context ApplicationContext getBean
<T> T getBean(String name, Class<T> requiredType) throws BeansException;
From source file:com.apress.prospringintegration.messageflow.filter.MainMessageSelectorItemFilter.java
public static void main(String[] args) throws Exception { ApplicationContext context = new ClassPathXmlApplicationContext("filter-selector.xml"); MessageChannel channel = context.getBean("marketItemChannel", MessageChannel.class); MarketItemCreator marketItemCreator = context.getBean("marketItemCreator", MarketItemCreator.class); for (MarketItem marketItem : marketItemCreator.getMarketItems()) { channel.send(MessageBuilder.withPayload(marketItem).build()); }// w w w. java 2 s. c om }
From source file:com.apress.prospringintegration.messageflow.filter.MainFilterDynamic.java
public static void main(String[] args) throws Exception { ApplicationContext context = new ClassPathXmlApplicationContext("filter-dynamic.xml"); MessageChannel channel = context.getBean("marketItemChannel", MessageChannel.class); MarketItemCreator marketItemCreator = context.getBean("marketItemCreator", MarketItemCreator.class); for (MarketItem marketItem : marketItemCreator.getMarketItems()) { channel.send(/* w w w . j a va 2 s. c om*/ MessageBuilder.withPayload(marketItem).setHeader("ITEM_TYPE", marketItem.getType()).build()); } }
From source file:com.apress.prospringintegration.messageflow.router.MainItemTypeRouter.java
public static void main(String[] args) throws Exception { ApplicationContext context = new ClassPathXmlApplicationContext("router-item-type.xml"); MessageChannel channel = context.getBean("marketItemChannel", MessageChannel.class); MarketItemCreator marketItemCreator = context.getBean("marketItemCreator", MarketItemCreator.class); for (MarketItem marketItem : marketItemCreator.getMarketItems()) { channel.send(MessageBuilder.withPayload(marketItem).build()); }//from www . j a v a 2s. co m }
From source file:siia.jms.GatewayDemo.java
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("siia/jms/gateways.xml"); MessageChannel toJMS = context.getBean("toJMS", MessageChannel.class); PollableChannel jmsReplies = context.getBean("jmsReplies", PollableChannel.class); MessagingTemplate template = new MessagingTemplate(); template.convertAndSend(toJMS, "echo"); Object response = template.receiveAndConvert(jmsReplies); System.out.println("response: " + response); }
From source file:com.apress.prospringintegration.messageflow.router.MainDynamicRouter.java
public static void main(String[] args) throws Exception { ApplicationContext context = new ClassPathXmlApplicationContext("router-dynamic.xml"); MessageChannel channel = context.getBean("marketItemChannel", MessageChannel.class); MarketItemCreator marketItemCreator = context.getBean("marketItemCreator", MarketItemCreator.class); for (MarketItem marketItem : marketItemCreator.getMarketItems()) { channel.send(/*from w w w . j a v a 2 s . c o m*/ MessageBuilder.withPayload(marketItem).setHeader("ITEM_TYPE", marketItem.getType()).build()); } }
From source file:com.apress.prospringintegration.messageflow.router.MainHeaderTypeMain.java
public static void main(String[] args) throws Exception { ApplicationContext context = new ClassPathXmlApplicationContext("router-item-type.xml"); MessageChannel channel = context.getBean("marketItemChannel", MessageChannel.class); MarketItemCreator marketItemCreator = context.getBean("marketItemCreator", MarketItemCreator.class); for (MarketItem marketItem : marketItemCreator.getMarketItems()) { channel.send(/*from w w w . j a v a 2 s . c o m*/ MessageBuilder.withPayload(marketItem).setHeader("ITEM_TYPE", marketItem.getType()).build()); } }
From source file:com.apress.prospringintegration.messageflow.filter.MainFilterExpression.java
public static void main(String[] args) throws Exception { ApplicationContext context = new ClassPathXmlApplicationContext("filter-expression.xml"); MessageChannel channel = context.getBean("marketItemChannel", MessageChannel.class); MarketItemCreator marketItemCreator = context.getBean("marketItemCreator", MarketItemCreator.class); for (MarketItem marketItem : marketItemCreator.getMarketItems()) { channel.send(//from w w w . j a v a 2 s .c om MessageBuilder.withPayload(marketItem).setHeader("ITEM_TYPE", marketItem.getType()).build()); } }
From source file:com.kang.spring.integration.service.http.HttpClientDemo.java
/** * @param args/*w w w . j a va 2 s. c om*/ */ public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); RequestGateway requestGateway = context.getBean("requestGateway", RequestGateway.class); String reply = requestGateway.echo("Hello"); log.info("Replied with: " + reply); }
From source file:com.mycompany.integration.NewMain.java
/** * @param args the command line arguments *//*from w w w.ja va 2 s .c o m*/ public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("spring-integration.xml"); MessageChannel channel = context.getBean("toRabbit", MessageChannel.class); for (int i = 0; i < 10; i++) { channel.send(build(UUID.randomUUID().toString())); } }
From source file:com.oak_yoga_studio.testing.Test.java
public static void main(String[] args) { // ConfigurableApplicationContext context=new ClassPathXmlApplicationContext("springconfig.xml"); ApplicationContext context = new ClassPathXmlApplicationContext("springconfig.xml"); CustomerDAO u = context.getBean("customerDAO", CustomerDAO.class); // create 2 users; Credential c = new Credential(); c.setRole("ROLE_ADMIN"); c.setUserName("senai"); c.setPassword("senai222"); User customer = new Customer(); customer.setFirstName("Senai"); customer.setEmail("Addagish"); customer.setEmail("senai@adagish.com"); customer.setCredential(c);//from w w w .ja va2 s .c o m //u.addCustomer(customer); }