스프링 컨테이너가 우리가 작성한 코드와 구성정보를 가지고 어떻게 무슨일을 하는지에 대해서 잘 나타낸 그림.
public class Client {
public static void main(String[] args) throws IOException {
BeanFactory benFactory = new AnnotationConfigApplicationContext(ObjectFactory.class);
PaymentService paymentService = benFactory.getBean(PaymentService.class);
PaymentService paymentService2 = benFactory.getBean(PaymentService.class);
System.out.println("paymentService = " + paymentService);
System.out.println("paymentService2 = " + paymentService2);
System.out.println("paymentService == paymentService2 = " + (paymentService == paymentService2));
Payment payment = paymentService.prepare(100L, "USD", BigDecimal.valueOf(50.7));
System.out.println(payment);
}
}