ApplicationContext - 스프링 컨테이너 (인터페이스)
스프링 컨테이너는 XML 기반으로 만들 수 있고 애노테이션 기반의 자바 설정 클래스로 만들 수도 있다.
new AnnotationConfigApplicationContext(*AppConfig*.class);
ApplicationContext 인터페이스의 구현체이다.스프링 컨테이너의 생성 과정
<aside> 💡 빈 이름은 항상 다른 이름을 부여해야 한다!
</aside>
스프링 컨테이너는 설정 정보를 참고해서 알아서 의존 관계를 주입한다!
빈 출력시 결과
beanDefinitionName = org.springframework.context.annotation.internalConfigurationAnnotationProcessorobject = org.springframework.context.annotation.ConfigurationClassPostProcessor@63611043
beanDefinitionName = org.springframework.context.annotation.internalAutowiredAnnotationProcessorobject = org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor@20ca951f
beanDefinitionName = org.springframework.context.annotation.internalCommonAnnotationProcessorobject = org.springframework.context.annotation.CommonAnnotationBeanPostProcessor@2d778add
beanDefinitionName = org.springframework.context.event.internalEventListenerProcessorobject = org.springframework.context.event.EventListenerMethodProcessor@73302995
beanDefinitionName = org.springframework.context.event.internalEventListenerFactoryobject = org.springframework.context.event.DefaultEventListenerFactory@1838ccb8
beanDefinitionName = appConfigobject = hello.core.AppConfig$$SpringCGLIB$$0@6c2ed0cd
beanDefinitionName = memberServiceobject = hello.core.member.MemberServiceImpl@7d9e8ef7
beanDefinitionName = memberRepositoryobject = hello.core.member.MemoryMemberRepository@f107c50
beanDefinitionName = orderServiceobject = hello.core.order.OrderServiceImpl@51133c06
beanDefinitionName = discountPolicyobject = hello.core.discount.RateDiscountPolicy@4b213651