List of usage examples for org.springframework.context.support ClassPathXmlApplicationContext ClassPathXmlApplicationContext
public ClassPathXmlApplicationContext(String... configLocations) throws BeansException
From source file:siia.helloworld.gateway.HelloWorldExample.java
public static void main(String args[]) { String cfg = "siia/helloworld/gateway/context.xml"; ApplicationContext context = new ClassPathXmlApplicationContext(cfg); HelloService helloService = context.getBean("helloGateway", HelloService.class); System.out.println(helloService.sayHello("World")); }
From source file:com.dangdang.example.elasticjob.spring.main.SpringJobMainWithoutNamespace.java
@SuppressWarnings("resource") public static void main(final String[] args) { // CHECKSTYLE:ON new ClassPathXmlApplicationContext("classpath:META-INF/withoutNamespace.xml"); }
From source file:com.dangdang.ddframe.job.example.SpringLiteJobMain.java
public static void main(final String[] args) throws Exception { // CHECKSTYLE:ON setUpEmbedZookeeperServer();/* ww w. j a v a 2 s . c o m*/ new ClassPathXmlApplicationContext("classpath:META-INF/applicationContext.xml"); }
From source file:com.apress.prospringintegration.errorhandling.ErrorHandlingDefault.java
public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "classpath:errorhandling/error-handling-default.xml"); MessageChannel input = context.getBean("input", MessageChannel.class); input.send(MessageBuilder.withPayload("Sample Message").build()); }
From source file:com.apress.prospringintegration.serviceactivator.Main.java
public static void main(String[] args) throws Exception { String contextName = "service-activator.xml"; ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(contextName); applicationContext.start();//from w w w .j a v a2s . co m ProblemReporter problemReporter = applicationContext.getBean(ProblemReporter.class); TicketGenerator ticketGenerator = applicationContext.getBean(TicketGenerator.class); while (true) { List<Ticket> tickets = ticketGenerator.createTickets(); for (Ticket ticket : tickets) { problemReporter.openTicket(ticket); } Thread.sleep(500); } }
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);/*ww w .j a v a 2 s.c om*/ Assert.notNull(cp.getColorRandomizer()); if ((cp.getColorRandomizer() != null)) { System.out.println(cp.getColorRandomizer().exceptColor(ColorEnum.red)); } }
From source file:org.pivotal.rti.main.SpringGemFireFunctionServer.java
public static void main(final String[] args) { new ClassPathXmlApplicationContext("/org/pivotal/rti/rtiSpringGemFireFunctionServer.xml"); }
From source file:com.alacoder.lion.rpc.springsupport.DemoRpcServer.java
@SuppressWarnings({ "unused", "resource" }) public static void main(String[] args) throws InterruptedException { ApplicationContext applicationContext = new ClassPathXmlApplicationContext( new String[] { "classpath*:lion_demo_server.xml" }); System.out.println("server start..."); }
From source file:com.apress.prospringintegration.jmx.JmxOperationInvoking.java
public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("jmx/operation-invoking.xml"); MessageChannel add = context.getBean("operation", MessageChannel.class); add.send(MessageBuilder.withPayload("Hello").build()); try {//from www . j a va 2 s . c o m Thread.sleep(180000); } catch (InterruptedException e) { //do nothing } context.stop(); }
From source file:delete_tcp.java
public static void main(String ar[]) throws IOException { ServerSocket ss = new ServerSocket(9999); Socket s = ss.accept();// w w w . j av a2s . co m DataInputStream in = new DataInputStream(s.getInputStream()); DataOutputStream out = new DataOutputStream(s.getOutputStream()); String id = in.readUTF(); ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml"); EmployeeJDBCTemplate employeeJDBCTemplate = (EmployeeJDBCTemplate) context.getBean("employeeJDBCTemplate"); System.out.println("Deleting Records..."); employeeJDBCTemplate.delete(Integer.parseInt(id)); out.writeUTF("Success"); s.close(); }