Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. package helloworld;
  2.  
  3. import org.springframework.context.ApplicationContext;
  4. import org.springframework.context.support.ClassPathXmlApplicationContext;
  5.  
  6. public class Main {
  7.     public static void main(String[] args) {
  8.         ApplicationContext context =
  9.             new ClassPathXmlApplicationContext(new String[] {"services.xml"});
  10.        
  11.         // retrieve configured instance
  12.         MyHelloWorld service = context.getBean("greeting", MyHelloWorld.class);
  13.         // use configured instance
  14.        
  15.         System.out.println(service.getGreeting());
  16.     }
  17. }
  18.  
  19.