SpringBootConfiguration
springboot注解 注解
注解
http://mp.weixin.qq.com/s?__biz=Mzg2MjEwMjI1Mg==&mid=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 **{<br /> **this**.postProcessBeanFactory(beanFactory);<br /> **this**.invokeBeanFactoryPostProcessors(beanFactory);<br /> **this**.registerBeanPostProcessors(beanFactory);<br /> **this**.initMessageSource();<br /> **this**.initApplicationEventMulticaster();<br /> **this**.onRefresh();<br /> **this**.registerListeners();<br /> **this**.finishBeanFactoryInitialization(beanFactory);<br /> **this**.finishRefresh();<br /> } **catch **(BeansException var9) {<br /> **if **(**this**.logger.isWarnEnabled()) {<br /> **this**.logger.warn(**"Exception encountered during context initialization - cancelling refresh attempt: " **+ var9);<br /> }
**this**.destroyBeans();<br /> **this**.cancelRefresh(var9);<br /> **throw **var9;<br /> } **finally **{<br /> **this**.resetCommonCaches();<br /> }
}<br />}
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();
}