#component-scan
글
-
Spring 소스 파헤치기 8: @Configuration과 @ComponentScan은 어떻게 설계도가 되나
설정 클래스(@Configuration)와 @Bean 메서드, @ComponentScan으로 찾은 @Component 클래스가 빈의 설계도(BeanDefinition)로 바뀌는 과정을 Spring을 처음 보는 사람 기준으로 따라갑니다. ConfigurationClassPostProcessor가 설계도를 읽어 설계도를 더하는 방법, 클래스를 로딩하지 않고 훑는 컴포넌트 스캔, 그리고 @Configuration 클래스가 CGLIB로 감싸져 @Bean 메서드를 두 번 불러도 같은 객체가 나오는 이유를 실제 소스와 예제로 확인합니다.