List of usage examples for org.springframework.context.support ClassPathXmlApplicationContext ClassPathXmlApplicationContext
public ClassPathXmlApplicationContext(String... configLocations) throws BeansException
From source file:com.mycompany.run.MainSpring.java
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("konfiguracja.xml"); UsersRepository userRepository = context.getBean("repozytoriumUzytkownikow", UsersRepository.class); User tomasz = userRepository.createUser("Tomasz_Spring"); }
From source file:com.mc.SpringEventHandling.java
/** * @param args the command line arguments */// ww w. j av a2 s . co m public static void main(String[] args) { // TODO code application logic here ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml"); Shape shape = (Shape) context.getBean("circleId"); shape.draw(); }
From source file:util.Main.java
public static void main(String[] args) { ApplicationContext appContext = new ClassPathXmlApplicationContext("applicationContext.xml"); SpecificTAAService genericTAAService = (SpecificTAAService) appContext.getBean("specificTAAService"); SpecificTAA genericTAA = new SpecificTAA(); genericTAA.setApprovedByDos(new Date()); genericTAA.setDraft(new Date()); genericTAA.setFullyExecuted(new Date()); genericTAA.setSubmissionToDoS(new Date()); genericTAA.setLicenseNumber("test2"); genericTAA.setSubject("test2"); genericTAA.setVersionNumber("test2"); genericTAAService.save(genericTAA);// w w w . ja va2s.c o m }
From source file:com.mycompany.beanstests.MainApp.java
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("/com/mycompany/beanstests/Beans.xml"); HelloWorld objA = (HelloWorld) context.getBean("helloWorld"); System.out.println(LINE);//from w w w . j a v a2 s.com objA.setMessage("I'm object A"); objA.getMessage(); objA.getName(); objA.getLast(); objA.setLast("Changed last"); System.out.println(LINE); HelloWorld objB = (HelloWorld) context.getBean("helloWorld"); objB.getMessage(); objB.getName(); objB.getLast(); System.out.println(LINE); HelloWorld protoA = (HelloWorld) context.getBean("helloWorldPrototype"); protoA.getMessage(); protoA.getName(); protoA.getLast(); System.out.println(LINE); HelloWorld templateA = (HelloWorld) context.getBean("helloTemplate"); templateA.getMessage(); templateA.getName(); templateA.getLast(); }
From source file:com.tsguild.masteryflooringproject.MasteryFlooringProjectApp.java
public static void main(String[] args) { ApplicationContext springFactory = new ClassPathXmlApplicationContext("applicationContext.xml"); MasteryFlooringProjectController controller = springFactory.getBean("controller", MasteryFlooringProjectController.class); controller.run();/*from w ww . ja v a 2 s . co m*/ }
From source file:pl.edu.amu.wmi.shop.Shop.java
public static void main(String[] args) throws InterruptedException { ApplicationContext context = new ClassPathXmlApplicationContext("Context.xml"); Thread.sleep(1000);/* ww w.j a v a2 s . co m*/ PublicKey publicKey = ((BankPublicKeyReceiverService) context.getBean("bankPublicKeyReceiverService")) .getBankPublicKey(); }
From source file:cs544.blog.App.java
License:asdf
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("springconfig.xml"); IBlogService blogService = context.getBean("blogService", IBlogService.class); // IPostService postService = new PostService(); User user = blogService.createUser("ajay", "ajay"); //blogService.createPost(user.getId(), "ha", "ta"); Post post = blogService.createPost(user.getId(), "asd ", "asdf"); // blogService.updatePost(post); // /*from ww w . j ava2s . c om*/ // List<User> users = blogService.getAllUser(); // for (User user:users){ // System.out.println(user); // } }
From source file:it.pcan.test.integration.amqp.MainServer.java
/** * @param args the command line arguments * @throws java.lang.Exception/* w w w . j a va 2s . c o m*/ */ public static void main(String[] args) throws Exception { try (ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "classpath:/config/serverApplicationContext.xml")) { new Scanner(System.in).nextLine(); // Press Enter key to stop System.out.println("Done."); } }
From source file:net.vnt.ussdapp.USSDApp.java
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "/context.xml" }); ContextProperties properties = (ContextProperties) Context.getInstance().getBean("ContextProperties"); try {//from w w w . j a v a2 s . co m if (USSD.initialize() == 0) { System.out.println("Error initializing"); return; } if (USSD.connect(properties.getProperty("ip.ussdgw"), properties.getInt("port.ussdgw")) == 0) { System.out.println("Error connecting"); return; } while (true) { Thread.sleep(1000); } } catch (InterruptedException ex) { ex.printStackTrace(); } }
From source file:inheritancespring.InheritanceSpring.java
/** * @param args the command line arguments *///from w w w .j av a 2 s . co m public static void main(String[] args) { // TODO code application logic here ApplicationContext context = new ClassPathXmlApplicationContext("Classes/beans.xml"); User user = (User) context.getBean("employee"); System.out.println(user.getName() + user.getPhone()); }