SpringBootConfiguration
springboot 注解 注解
public void **refresh() **throws **BeansException, IllegalStateException {
Object var1 = **this.startupShutdownMonitor;
synchronized(this.startupShutdownMonitor) {
this.prepareRefresh();
ConfigurableListableBeanFactory beanFactory = this.obtainFreshBeanFactory();
this.prepareBeanFactory(beanFactory);
**<font style="color:rgb(0, 0, 128);">try </font>**{
**<font style="color:rgb(0, 0, 128);">this</font>**.postProcessBeanFactory(beanFactory);
**<font style="color:rgb(0, 0, 128);">this</font>**.invokeBeanFactoryPostProcessors(beanFactory);
**<font style="color:rgb(0, 0, 128);">this</font>**.registerBeanPostProcessors(beanFactory);
**<font style="color:rgb(0, 0, 128);">this</font>**.initMessageSource();
**<font style="color:rgb(0, 0, 128);">this</font>**.initApplicationEventMulticaster();
**<font style="color:rgb(0, 0, 128);">this</font>**.onRefresh();
**<font style="color:rgb(0, 0, 128);">this</font>**.registerListeners();
**<font style="color:rgb(0, 0, 128);">this</font>**.finishBeanFactoryInitialization(beanFactory);
**<font style="color:rgb(0, 0, 128);">this</font>**.finishRefresh();
} **<font style="color:rgb(0, 0, 128);">catch </font>**(BeansException var9) {
**<font style="color:rgb(0, 0, 128);">if </font>**(**<font style="color:rgb(0, 0, 128);">this</font>**.logger.isWarnEnabled()) {
**<font style="color:rgb(0, 0, 128);">this</font>**.logger.warn(**<font style="color:rgb(0, 128, 0);">"Exception encountered during context initialization - cancelling refresh attempt: " </font>**+ var9);
}
**<font style="color:rgb(0, 0, 128);">this</font>**.destroyBeans();
**<font style="color:rgb(0, 0, 128);">this</font>**.cancelRefresh(var9);
**<font style="color:rgb(0, 0, 128);">throw </font>**var9;
} **<font style="color:rgb(0, 0, 128);">finally </font>**{
**<font style="color:rgb(0, 0, 128);">this</font>**.resetCommonCaches();
}
}
}
public void refresh() throws BeansException, IllegalStateException {
Object var1 = this.startupShutdownMonitor;
synchronized(this.startupShutdownMonitor) {
this.prepareRefresh();
ConfigurableListableBeanFactory beanFactory = this.obtainFreshBeanFactory();
this.prepareBeanFactory(beanFactory);
try {
this.postProcessBeanFactory(beanFactory);
this.invokeBeanFactoryPostProcessors(beanFactory);
this.registerBeanPostProcessors(beanFactory);
this.initMessageSource();
this.initApplicationEventMulticaster();
this.onRefresh();
this.registerListeners();
this.finishBeanFactoryInitialization(beanFactory);
this.finishRefresh();
} catch (BeansException var9) {
if (this.logger.isWarnEnabled()) {
this.logger.warn("Exception encountered during context initialization - cancelling refresh attempt: " + var9);
}
this.destroyBeans();
this.cancelRefresh(var9);
throw var9;
} finally {
this.resetCommonCaches();
}
}
}
refresh()–>onRefresh()–>createWebServer()–>
private void createWebServer() {
WebServer webServer = this.webServer;
ServletContext servletContext = getServletContext();
if (webServer == null && servletContext == null) {
ServletWebServerFactory factory = getWebServerFactory();
this.webServer = factory.getWebServer(getSelfInitializer());
}
else if (servletContext != null) {
try {
getSelfInitializer().onStartup(servletContext);
}
catch (ServletException ex) {
throw new ApplicationContextException("Cannot initialize servlet context",
ex);
}
}
initPropertySources();
}