List of usage examples for org.springframework.context.support ClassPathXmlApplicationContext ClassPathXmlApplicationContext
public ClassPathXmlApplicationContext(String... configLocations) throws BeansException
From source file:demo.jaxrs.client.BasicSpringClient.java
public static void main(String args[]) throws Exception { // Initialize the spring context and fetch our test client ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( new String[] { "classpath:client-applicationContext.xml" }); CustomerService proxy = (CustomerService) context.getBean("restClient"); List<PolicyTO> policies = (List<PolicyTO>) proxy.listByType(PolicyType.PASSWORD); for (PolicyTO policy : policies) { System.out.println("Listed Policy: " + policy.getClass()); }//from w w w . ja va 2 s . c o m }
From source file:org.openflamingo.uploader.Starter.java
public static void main(String[] args) { AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext( "classpath:applicationContext.xml"); applicationContext.registerShutdownHook(); }
From source file:test.go.java
public static void main(String... args) { System.setProperty("curator-log-events", "true"); IHyperGateServer server;//from www . j a va 2 s.co m ApplicationContext applicationContext = new ClassPathXmlApplicationContext( "META-INF/hypergate-server-context.xml"); ServerFactory.Builder builderAdvertiser = applicationContext.getBean("serverBuilder", ServerFactory.Builder.class); LOG.debug("--------------------------------------------------------"); LOG.debug("Builder properties:"); LOG.debug("Name:" + builderAdvertiser.getName()); LOG.debug("Instance Name:" + builderAdvertiser.getInstanceName()); LOG.debug("port:" + builderAdvertiser.getPort()); LOG.debug("isAutoSelectPort:" + builderAdvertiser.isAutoSelectPort()); LOG.debug("Type:" + builderAdvertiser.getType()); LOG.debug("Zookeeper connection string:" + builderAdvertiser.getZookeeperHosts()); LOG.debug("Zookeeper base path:" + builderAdvertiser.getServiceBasePath()); server = builderAdvertiser.build(); LOG.debug("\n\n"); LOG.debug("--------------------------------------------------------"); LOG.debug("After server initialization - properties"); LOG.debug("\n"); LOG.debug("Server properties:"); LOG.debug("......"); LOG.debug("Name:" + server.getName()); LOG.debug("Instance Name:" + server.getInstanceName()); LOG.debug("port:" + server.getPort()); server.start(); LOG.debug("Server started"); }
From source file:org.excalibur.fm.configuration.Main.java
@SuppressWarnings("resource") public static void main(String[] args) throws InterruptedException { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "classpath*:META-INF/applicationContext.xml"); final ProviderService providerService = context.getBean(ProviderService.class); configureLookAndFeel();// ww w .ja v a 2 s . co m final JFrame frame = new JFrame(); frame.getContentPane().add(new InstanceSelectionPanel(providerService)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // frame.pack(); frame.setSize(1118, 470); frame.setLocationRelativeTo(null); java.awt.EventQueue.invokeLater(new Runnable() { public void run() { frame.setVisible(true); } }); // Thread.currentThread().join(); // context.close(); }
From source file:org.apache.camel.loanbroker.webservice.version.LoanBroker.java
public static void main(String... args) throws Exception { // create a new main which will boot the Spring XML file Main main = new Main(); main.setApplicationContext(//from w w w .j a v a 2s. c om new ClassPathXmlApplicationContext("META-INF/spring/webServiceCamelContext.xml")); main.enableHangupSupport(); main.run(); }
From source file:com.hsbc.srbp.commonMsg.test.Main.java
/** * Load the Spring Integration Application Context * * @param args - command line arguments//from w ww .j av a2 s . c o m */ public static void main(final String... args) { final AbstractApplicationContext context = new ClassPathXmlApplicationContext( "jdbcInboundApplicationContext.xml"); context.registerShutdownHook(); final Scanner scanner = new Scanner(System.in); final CommonMessageService commonMessageService = context.getBean(CommonMessageService.class); System.out.println("\n=========================================================" + "\n " + "\n Please press 'q + Enter' to quit the application. " + "\n " + "\n========================================================="); System.out.println("Please enter a choice and press <enter>: "); System.out.println("\t1. Create a new message detail"); System.out.println("\tq. Quit the application"); System.out.print("Enter you choice: "); while (true) { final String input = scanner.nextLine(); if ("1".equals(input.trim())) { createMessageDetails(scanner, commonMessageService, context); } else if ("q".equals(input.trim())) { break; } else { System.out.println("Invalid choice\n\n"); } System.out.println("Please enter a choice and press <enter>: "); System.out.println("\t1. Create a new message detail"); System.out.println("\tq. Quit the application"); System.out.print("Enter you choice: "); } System.out.println("Exiting application...."); System.exit(0); }
From source file:com.reversemind.hypergate.spring.HyperGateClientSpringContextLoader.java
public static void main(String... args) throws Exception { ApplicationContext applicationContext = new ClassPathXmlApplicationContext( "META-INF/hypergate-client-context.xml"); HyperGateClientServerDiscovery client = (HyperGateClientServerDiscovery) applicationContext.getBean( AbstractContainerHyperGateClient.CLIENT_DISCOVERY_BUILDER_NAME, AbstractContainerHyperGateClient.CLASS_HYPERGATE_CLIENT_SERVER_DISCOVERY); client.start();//w w w. ja va2s. com Thread.sleep(40000); client.shutdown(); }
From source file:com.sundy.motan.client.AnnotationRpcClientDemo.java
public static void main(String[] args) throws InterruptedException { ApplicationContext ctx = new ClassPathXmlApplicationContext( new String[] { "classpath:motan_demo_client_annotation.xml" }); DemoRpcHandler handler = (DemoRpcHandler) ctx.getBean("demoRpcHandler"); handler.test();//from ww w . j a v a 2 s .c om System.out.println("motan demo is finish."); System.exit(0); }
From source file:trendulo.ingest.Ingest.java
/** * @param args// w w w. j ava 2s . c om */ public static void main(String[] args) { final Logger log = Logger.getLogger(Ingest.class); ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); // Start the N-Gram Source final TemporalNGramSource nGramSource = (TemporalNGramSource) context.getBean("nGramSource"); Thread nGramSourceThread = new Thread(nGramSource); nGramSourceThread.start(); // Start the N-Gram Ingester that will take from the source final TemporalNGramIngester nGramIngester = (TemporalNGramIngester) context.getBean("nGramIngester"); Thread nGramIngesterThread = new Thread(nGramIngester); nGramIngesterThread.start(); Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { log.info("Shutting Down Ingest..."); nGramSource.shutdown(); nGramIngester.shutdown(); } }); }
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 ww w . j av a 2s . c om }