5.run() 메서드
SpringApplication.run()의 동작 과정
MainApplication.java
@SpringBootApplication
public class MainApplication {
public static void main(String[] args) {
SpringApplication.run(PetclinicApplication.class, args);
}
}SpringApplication.run()가 호출될 때 아래의 과정이 수행됨
-
클래스 패스에 구성된 라이브러리들을 기준으로 ApplicationContext(스프링 컨테이너)를 생성
-
CommandLinePropertySource를 통해 명령행(CLI)으로 입력받은 인자를 스프링 프로퍼티로 읽어들임
-
1번에서 생성한 ApplicationContext를 통해 모든 Singleton Bean을 로딩
-
애플리케이션에 설정된 ApplicationRunners와 CommandRunners를 실행
run() 부분을 브레이크포인트로 지정 후 디버그 모드로 실행해보기
Last updated on