Exemple #1
0
  public static void main(String[] args) {
    ApplicationContext context =
        new ClassPathXmlApplicationContext("step04/application-context02.xml");

    Computer c1 = (Computer) context.getBean("c1");
    Computer c2 = (Computer) context.getBean("c2");
    Computer c3 = (Computer) context.getBean("c3");
    System.out.println(c1);
    System.out.println(c2);
    System.out.println(c3);

    System.out.println(c1.getMonitor().hashCode());
    System.out.println(c3.getMonitor().hashCode());

    if (c1.getMonitor() == c3.getMonitor()) {
      System.out.println("c1의 모니터 == c3의 모니터");
    }
  }