강의

멘토링

커뮤니티

Inflearn Community Q&A

heagijoa's profile image
heagijoa

asked

Spring Core Principles - Basic Edition

Scan Locations and Default Targets

스프링부트 사용 방법

Written on

·

211

0

스프링 부트를 사용하면(@SpringBootApplication를 사용하면)

설정 파일을 따로 만들지않고

클래스에 @Repository, @Service, @Controller를 붙여서

자동으로 빈을 등록하고 주입받는 방식으로 개발을 하는건가요?

springoop

Answer 1

0

안녕하세요. 김동민 님, 공식 서포터즈 codesweaver 입니다.

.

@SpringBootApplication 안에 @ComponentScan이 포함되어 있는데 이 때문에 애플리케이션이 실행될 떄 Component들을 전부 찾는 과정이 실행됩니다.

@Repository, @Service, @Controller는 모두 @Component 애노테이션을 상속받고 있기에 ComponentScan 과정에서 스프링 빈으로 등록됩니다.

.
감사합니다.

heagijoa's profile image
heagijoa

asked

Ask a question