강의

멘토링

커뮤니티

Inflearn Community Q&A

chinok03279280's profile image
chinok03279280

asked

Spring Core Principles - Basic Edition

View all registered beans in container

@Component로 등록한 빈을 조회하는 방법은 어떤게 있나요?

Written on

·

456

0

@Component로 등록한 빈을 조회하는 방법은 어떤게 있나요?

궁금합니다. 아래와 같은 코드가 아니라 다른 클래스를 이용해야 하나요?

AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext(AppConfig.class
);
springoop

Answer 1

0

안녕하세요. 고범준님, 공식 서포터즈 David입니다.

아래와 같은 방법으로 Component 애노테이션을 가지고 있는 빈을 컨테이너로부터 조회할 수 있습니다.

ac.getBeansWithAnnotation(Component.class);

감사합니다.

chinok03279280's profile image
chinok03279280

asked

Ask a question