1、new SpringApplication(primarySources)会执行下面初始化 根据META-INF/spring.factories 会实例如下初始化 SharedMetadataReaderFactoryContextInitializer ConfigurationWarningsApplicationContextInitializer ContextIdApplicationContextInitializer DelegatingApplicationContextInitializer RSocketPortInfoApplicationContextInitializer ServerPortInfoApplicationContextInitializer ConditionEvaluationReportLoggingListener 2、初始化完成后会createApplicationContext(); 执行上面代码会创建 AnnotationConfigServletWebServerApplicationContext 然后这里会创建5个 beanDefinitionNames,加入到BeanFactory,后面会将启动类来加入到beanfactory,总共是6个beanDefinitionNames 加入@EnableWebSocketMessageBroker 这个注解的配置类,import DelegatingWebSocketMessageBrokerConfiguration extends StompBrokerRelayMessageHandler,里面有一@bean,进行初始化 初始化完成后,refreshContext()–>finishRefresh()启动tcp网络监听;如下源码 下面是启动Debug步骤
|