Search
🌱

Springboot μ„œλ²„κ°€ ꡬ동될 λ•Œ

λΉˆμ„ μ½λŠ” 방법

ConfigurableApplicationContext λ₯Ό μ„ νƒν•˜λŠ” 방법
SpringApplication 의 run μ—μ„œ
createApplicationContext() λ₯Ό 톡해 μ„ μ •λœλ‹€.
createApplicationContext() μ—μ„œλŠ” SpringApplication 이 생성될 λ•Œ κΈ°λ³Έκ°’μœΌλ‘œ μƒμ„±λœ ApplicationContextFactory 둜 applicationContext λ₯Ό λ§Œλ“ λ‹€. λ§Œλ“€ λ•Œ webApplicationType(enum) 을 인자둜 μ£ΌλŠ”λ°, 이 μΈμžλŠ” SpringApplication 의 μƒμ„±μžμ—μ„œ deduceFromClasspath() λ©”μ„œλ“œλ₯Ό 톡해 μ„€μ •λœλ‹€.
ν•΄λ‹Ή λ©”μ„œλ“œμ—μ„œλŠ” DispatcherHandler κ°€ class loader 에 있고, DispatcherServlet κ³Ό ServletContainer κ°€ μ—†μ–΄μ•Ό REACTIVE λ₯Ό λ°˜ν™˜ν•˜κ³  μ•„λ‹ˆλ©΄ SERVLET 을 λ°˜ν™˜ν•œλ‹€.
ApplicationContextFactory 의 κ΅¬ν˜„μ²΄λŠ” DefaultApplicationContextFactory 인데, μ—¬κΈ°μ„œ create λ₯Ό ν•œλ‹€. 결과적으둜 context λŠ” AnnotationConfigReactiveWebServerApplicationContext 이 μ„ μ •λœλ‹€.

λΉˆμ€ μ–Έμ œ λ“±λ‘λ κΉŒ

β€’
SpringApplication.createApplicationContext()
β—¦
DefaultApplicationContextFactory.create()
β—¦
DefaultApplicationContextFactory.getFromSpringFactories()
β—¦
ReactiveWebServerApplicationContextFactory.create(WebApplicationType)
β—¦
ReactiveWebServerApplicationContextFactory.createContext()
β—¦
AnnotationConfigReactiveWebServerApplicationContext()
β—¦
initAnnotationConfigReactiveWebServerApplicationContext. newAnnotatedBeanDefinitionReader(this) β†’ this = ACRWSAC
β—¦
init AnnotatedBeanDefinitionReader.AnnotationConfigUtils.registerAnnotationConfigProcessors()
β—¦
AnnotationConfigUtils.registerAnnotationConfigProcessors()
β—¦
AnnotationConfigUtils.registerPostProcessor()
β—¦
registry.registerBeanDefinition() registry β†’ GenericApplicationContext
β—¦
GenericApplicationContext.registerBeanDefinition()
β—¦
DefaultListableBeanFactory.registerBeanDefinition()

λΉˆμ€ μ–΄λ””μ„œ λ“±λ‘λ κΉŒ

DefaultListableBeanFactory 의 registerBeanDefinition