🔹 모든 자바 객체의 최상위 부모는 Object
//Object로 빈 조회
AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext();
@Test
@DisplayName("Object 타입으로 조회")
void findByObject() {
Map<String, Object> beansOfType = ac.getBeansOfType(Object.class);
for (String key : beansOfType.keySet()) {
System.out.println("key = "+key+"value = "+beansOfType.get(key));
}
}
위와 같은 테스트를 수행하면 스프링에 등록된 모든 빈이 출력된다.
인프런 스프링 핵심 원리 - 기본편 (김영한) 참조