List of usage examples for org.springframework.context.support ClassPathXmlApplicationContext ClassPathXmlApplicationContext
public ClassPathXmlApplicationContext(String... configLocations) throws BeansException
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);/* w ww. j a va 2s. c o m*/ //u.addCustomer(customer); }
From source file:com.apress.prospringintegration.adapters.Main.java
public static void main(String[] args) { ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("adapters.xml"); applicationContext.start();/*from w w w . ja v a 2 s. c o m*/ }
From source file:org.tanzim.javabrains.DrawingApp.java
public static void main(String[] args) { System.out.print("Hello World\n"); // BeanFactory factory = new XmlBeanFactory(new FileSystemResource("spring.xml")); // Triangle t = (Triangle) factory.getBean("triangle"); ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml"); Triangle t = (Triangle) context.getBean("triangle-alias"); t.draw();//from w ww . ja v a 2 s. c o m }
From source file:dubbo.TestDAL.java
public static void main(String[] args) throws IOException { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( new String[] { "dubbo/consumer.xml" }); context.start();/*from ww w . ja va 2 s . c o m*/ context.getBean("dal"); }
From source file:com.apress.prospringintegration.jmx.JmxAttributePolling.java
public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("jmx/attribute-polling.xml"); try {/*from ww w.ja v a2s .com*/ Thread.sleep(180000); } catch (InterruptedException e) { //do nothing } context.stop(); }
From source file:com.spring.tutorial.configuration.hybrid.App.java
public static void main(String[] args) { LOGGER.info("Creating and starting container with configuration A"); ApplicationContext ctxA = new ClassPathXmlApplicationContext( "com/spring/tutorial/configuration/hybrid/applicationContextA.xml"); ((ClassPathXmlApplicationContext) ctxA).close(); LOGGER.info("Creating and starting container with configuration B"); ApplicationContext ctxB = new AnnotationConfigApplicationContext(AppConfigB.class); ((AnnotationConfigApplicationContext) ctxB).close(); }
From source file:org.copperengine.examples.orchestration.Main.java
/** * @param args//from www .ja v a2 s. c om */ public static void main(String[] args) { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("OrchestrationEngineContext.xml"); ctx.registerShutdownHook(); }
From source file:com.apress.prospringintegration.customadapters.outbound.Main.java
static public void main(String[] args) throws Throwable { ClassPathXmlApplicationContext cax = new ClassPathXmlApplicationContext( "com/apress/prospringintegration/customadapters/outbound/MainWithNamespace-context.xml"); }
From source file:com.apress.prospringintegration.jmx.JmxNotificationListener.java
public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "jmx/notification-listener.xml"); try {// w ww . ja va 2s .c o m Thread.sleep(180000); } catch (InterruptedException e) { //do nothing } context.stop(); }
From source file:uta.ak.ExecQuartzJob.java
public static void main(String[] args) throws Exception { SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); ApplicationContext applicationContext = new ClassPathXmlApplicationContext("quartzContext.xml"); Scheduler quartzScheduler = (Scheduler) applicationContext.getBean("quartzScheduler"); JobDetail jobDetail = JobBuilder.newJob(CollectTwitterJob.class) .withIdentity("qrtz_job_collecttwitter", "qrtz_job_collecttwitter").build(); SimpleScheduleBuilder builder = SimpleScheduleBuilder.simpleSchedule().repeatSecondlyForTotalCount(1000) .withIntervalInHours(24);/*from w w w. j a va2s .c o m*/ Trigger trigger = TriggerBuilder.newTrigger() .withIdentity("qrtz_trigger_collecttwitter", "qrtz_trigger_collecttwitter") .startAt(format1.parse("2016-08-03 00:05:00")).withSchedule(builder).build(); // quartzScheduler.scheduleJob(jobDetail, trigger); }