Guest User

Untitled

a guest
Feb 3rd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1. package com.spring1.learning;
  2.  
  3. import org.springframework.context.ApplicationContext;
  4. import org.springframework.context.support.ClassPathXmlApplicationContext;
  5.  
  6.  
  7. /**
  8.  * Created by marcel on 03.02.17.
  9.  */
  10. public class MainApp {
  11.     public static void main(String[] args) {
  12.         ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml");
  13.  
  14.         HelloWorld obj = (HelloWorld) context.getBean("HelloWorld");
  15.  
  16.         obj.getMessage();
  17.     }
  18. }
  19.  
  20. package com.spring1.learning;
  21.  
  22. /**
  23.  * Created by marcel on 03.02.17.
  24.  */
  25. public class HelloWorld {
  26.     private String message;
  27.  
  28.     public void setMessage(String message){
  29.         this.message  = message;
  30.     }
  31.  
  32.     public void getMessage(){
  33.         System.out.println("Your Message : " + message);
  34.     }
  35. }
Add Comment
Please, Sign In to add comment