SpringBootConfiguration
springboot 注解 注解
注解
http://mp.weixin.qq.com/s?__biz=Mzg2MjEwMjI1Mg==∣=2247517350&idx=1&sn=96ab31817c899bd12254dda46b5c7e2f
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();
}
}
}
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();
}