강의

멘토링

커뮤니티

Inflearn Community Q&A

momoto's profile image
momoto

asked

Spring Core Principles - Basic Edition

Scan Locations and Default Targets

Springboot를 사용할땐 AutoAppConfig , AppConfig가 없어도 되는건가요?

Written on

·

731

0

@SpringBootApplication 에 @ComponentScan이 존재하니 CoreApplication을 최상단에 두고 하면 정상적으로 돌아간다고 이해해도 되는걸까요? 

@SpringBootApplication에 존재하는 @ComponentScan에는 필터가 존재한다고 했는데 , 이 필터에 해당되는 클래스만 수동으로 빈으로 등록하고 싶을때 AutoAppConfig를 쓰면 될까요? 

스프링spring스프링부트oopspringboot

Answer 1

2

안녕하세요. 모모토 님, 공식 서포터즈 codesweaver 입니다.

.
네 말씀하신 것처럼 @SpringBootApplication에 @ComponentScan이 존재하며 애플리케이션 가동 시 @Component들을 DI컨테이너에 등록하게 됩니다. 

.

수동으로 등록하고자 하는 빈이 있다면 @Configuration 애노테이션을 붙인 객체를 생성하여 사용하시면 됩니다.

.
감사합니다.

momoto's profile image
momoto

asked

Ask a question