List of usage examples for org.springframework.context.support ClassPathXmlApplicationContext ClassPathXmlApplicationContext
public ClassPathXmlApplicationContext(String... configLocations) throws BeansException
From source file:com.apress.prospringintegration.jmx.JmxOperationGateway.java
public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("jmx/operation-gateway.xml"); Map<String, Integer> parameters = new HashMap<String, Integer>(); parameters.put("p1", 5); parameters.put("p2", 7); MessageChannel request = (MessageChannel) context.getBean("request"); request.send(MessageBuilder.withPayload(parameters).build()); try {/* w w w . j a va2 s . c o m*/ Thread.sleep(180000); } catch (InterruptedException e) { //do nothing } context.stop(); }
From source file:com.delphix.appliance.host.example.client.ExampleClientLauncher.java
public static void main(String[] args) { AbstractApplicationContext context = new ClassPathXmlApplicationContext(CONFIG_LOCATION); try {//from w w w . j a v a2s . co m ExampleClient client = (ExampleClient) context.getBean("client"); client.executeRemoteCommand(); client.fini(); } finally { context.close(); } }
From source file:com.anteam.alter.sample.email.TestEmailAntlert.java
public static void main(String[] args) { @SuppressWarnings("resource") ApplicationContext factory = new ClassPathXmlApplicationContext( "classpath:springApplication-antlert-email.xml"); EmailAntlert emailAntlert = (EmailAntlert) factory.getBean("emailAntlert"); AntlertMessage antlertMsg = new AntlertMessage(); antlertMsg.setContent("Content"); antlertMsg.setLevel("ERROR"); antlertMsg.setOccurrenceTime(new Date()); antlertMsg.setTitle("Title"); antlertMsg.setSubject("subject"); emailAntlert.send(antlertMsg);/*from w w w . ja va 2s .com*/ }
From source file:net.cristcost.test.jpa.SpringLauncher.java
/** * @param args/*from w w w. ja v a 2 s .co m*/ * @throws IOException * @throws InterruptedException */ public static void main(String[] args) throws IOException { ConfigurableApplicationContext springContext = new ClassPathXmlApplicationContext( "META-INF/spring/beans.xml"); System.out.println("Press ENTER to exit"); System.in.read(); System.out.println("exit"); springContext.close(); }
From source file:com.alibaba.dubbo.examples.annotation.AnnotationProvider.java
public static void main(String[] args) throws Exception { String config = AnnotationProvider.class.getPackage().getName().replace('.', '/') + "/annotation-provider.xml"; ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config); context.start();//from w ww.ja va 2s. co m System.in.read(); }
From source file:uk.ac.ebi.ricordo.rdfconverter.ReactomeMain.java
public static void main(String[] args) { ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath*:reactome-config.xml"); ReactometoRDFGenerator reactometoRDFGenerator = (ReactometoRDFGenerator) ctx .getBean("reactometoRDFGenerator"); // reactometoRDFGenerator.aModeltoRDF(); reactometoRDFGenerator.allModelstoRDF(); }
From source file:com.testing.AnalyzeAlgorithms.java
public static void main(String args[]) throws SQLException, ClassNotFoundException { //Obtain beans and attach the relevant aspects found in the specifications. ApplicationContext appContext = new ClassPathXmlApplicationContext(new String[] { "Spring-Algos.xml" }); MyRecursiveBinarySearch bsearch = (MyRecursiveBinarySearch) appContext.getBean("binarySearchProxy"); MyQuickSort qsort = (MyQuickSort) appContext.getBean("quickSortProxy"); MyInterpolationSearch isearch = (MyInterpolationSearch) appContext.getBean("interpolationSearchProxy"); MyHeapSort hsort = (MyHeapSort) appContext.getBean("heapSortProxy"); JavaSort jsort = (JavaSort) appContext.getBean("javaSortProxy"); JavaSearch jsearch = (JavaSearch) appContext.getBean("javaSearchProxy"); for (int i = 0; i < 25; i++) { bsearch.recursiveBinarySearch(); AddMeasurementDAO.insertMeasurement("Binary Search"); int[] array = { 2, 45, 59, 128, 200, 234, 298, 301, 402, 500, 567, 602, 680, 734, 788, 802, 876, 900, 976, 999 };//from ww w . j a va 2s .c o m int value = 876; int from = 0; int to = 19; isearch.interpolationSearch(array, value, from, to); AddMeasurementDAO.insertMeasurement("Interpolation Search"); jsearch.search(array, value); AddMeasurementDAO.insertMeasurement("Java Search"); } for (int i = 0; i < 25; i++) { int array[] = { i * 10, 5, 2, 102, 33, 1, 7821, 21, 921, i * 10000, 54, 12, 2222, 120, 3431, 2, 11345413, 212, i * 100 }; qsort.sort(array); AddMeasurementDAO.insertMeasurement("Quick Sort"); hsort.sort(array); AddMeasurementDAO.insertMeasurement("Heap Sort"); jsort.sort(array); AddMeasurementDAO.insertMeasurement("Java Sort"); } }
From source file:com.delphix.appliance.host.example.server.ExampleServerLauncher.java
public static void main(String[] args) { AbstractApplicationContext context = new ClassPathXmlApplicationContext(CONFIG_LOCATION); try {//from w w w. ja v a2 s . c om final ExampleServer server = (ExampleServer) context.getBean("server"); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { server.fini(); } }); } finally { context.close(); } }
From source file:edu.hm.cs.goetz1.seminar.Main.java
public static void main(String[] args) { AbstractApplicationContext context = new ClassPathXmlApplicationContext("beans.xml"); UserService userService = (UserService) context.getBean(UserService.class); userService.addNewUser("test@email.de", "Max", "Mustermann", "totalGeheim", new Date()); userService.changeUserPassword("test@email.de", "totalGeheim", "nochGeheimer"); context.close();/* w w w. ja v a 2s . c o m*/ }
From source file:com.apress.prospringintegration.springbatch.integration.Main.java
public static void main(String[] args) throws Throwable { ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext( "integration.xml"); classPathXmlApplicationContext.start(); JobLauncher jobLauncher = (JobLauncher) classPathXmlApplicationContext.getBean("jobLauncher"); Job job = (Job) classPathXmlApplicationContext.getBean("importData"); JobParametersBuilder jobParametersBuilder = new JobParametersBuilder(); jobParametersBuilder.addDate("date", new Date()); jobParametersBuilder.addString("input.file", "registrations"); JobParameters jobParameters = jobParametersBuilder.toJobParameters(); JobExecution jobExecution = jobLauncher.run(job, jobParameters); BatchStatus batchStatus = jobExecution.getStatus(); while (batchStatus.isRunning()) { System.out.println("Still running..."); Thread.sleep(1000);// ww w . jav a2 s .c o m } System.out.println("Exit status: " + jobExecution.getExitStatus().getExitCode()); JobInstance jobInstance = jobExecution.getJobInstance(); System.out.println("job instance Id: " + jobInstance.getId()); }