当前位置: 首页 > news >正文

网站托管费用多少长沙制作公园仿竹围栏厂家电话

网站托管费用多少,长沙制作公园仿竹围栏厂家电话,网站地图怎么做一键导航,肇庆做网站设计从监听器到事件 SpringApplication运行中触发事件#xff0c;多播器发送事件到监听器#xff0c;监听器处理事件。 SpingApplication中事件都是经过SpringApplicationRunListeners类传送到各个监听器。 以starting事件为例 void starting(ConfigurableBootstrapContext boo…从监听器到事件 SpringApplication运行中触发事件多播器发送事件到监听器监听器处理事件。 SpingApplication中事件都是经过SpringApplicationRunListeners类传送到各个监听器。 以starting事件为例 void starting(ConfigurableBootstrapContext bootstrapContext, Class? mainApplicationClass) {doWithListeners(spring.boot.application.starting, (listener) - listener.starting(bootstrapContext),(step) - {if (mainApplicationClass ! null) {step.tag(mainApplicationClass, mainApplicationClass.getName());}}); }private void doWithListeners(String stepName, ConsumerSpringApplicationRunListener listenerAction,ConsumerStartupStep stepAction) {StartupStep step this.applicationStartup.start(stepName);this.listeners.forEach(listenerAction);if (stepAction ! null) {stepAction.accept(step);}step.end(); }这里的this.listeners是一个SpringApplicationRunListener的集合而SpringApplicationRunListener的实现类配置中只有一个EventPublishingRunListener starting事件执行的是EventPublishingRunListener的starting方法 public void starting(ConfigurableBootstrapContext bootstrapContext) {this.initialMulticaster.multicastEvent(new ApplicationStartingEvent(bootstrapContext, this.application, this.args)); }这里就找到了第一个事件ApplicationStartingEvent 接着往下执行 public void multicastEvent(ApplicationEvent event) {multicastEvent(event, resolveDefaultEventType(event)); }Override public void multicastEvent(final ApplicationEvent event, Nullable ResolvableType eventType) {ResolvableType type (eventType ! null ? eventType : resolveDefaultEventType(event));Executor executor getTaskExecutor();for (ApplicationListener? listener : getApplicationListeners(event, type)) {if (executor ! null) {executor.execute(() - invokeListener(listener, event));}else {invokeListener(listener, event);}} }ResolvableType类这里略过里面涉及的内容较多在这里的具体作用是从类的注解、泛型、继承结构、代理上获取原始的目标对象。 这里要注意的方法getApplicationListeners根据事件类型获取监听器然后执行。 查找的过程比较长这里列举一些比较重要的方法 类AbstractApplicationEventMulticaster的getApplicationListeners、retrieveApplicationListeners、supportsEvent。 supportsEvent方法中有具体的判断逻辑 protected boolean supportsEvent(ApplicationListener? listener, ResolvableType eventType, Nullable Class? sourceType) {GenericApplicationListener smartListener (listener instanceof GenericApplicationListener ?(GenericApplicationListener) listener : new GenericApplicationListenerAdapter(listener));return (smartListener.supportsEventType(eventType) smartListener.supportsSourceType(sourceType)); }根据监听器的类型调用监听器类的支持事件类型supportsEventType和支持事件源类型supportsSourceType两个方法来判断是否传播到该监听器。 ApplicationListener监听器有多个实现。 ClearCachesApplicationListenerParentContextCloserApplicationListenerFileEncodingApplicationListenerAnsiOutputApplicationListenerDelegatingApplicationListenerLoggingApplicationListenerEnvironmentPostProcessorApplicationListenerBackgroundPreinitializer ClearCachesApplicationListener 结构 implements ApplicationListenerContextRefreshedEvent 支持的事件类型 ContextRefreshedEventApplicationContextEventApplicationEvent 支持的事件源 无限制 ParentContextCloserApplicationListener 结构: implements ApplicationListenerParentContextAvailableEvent, ApplicationContextAware, Ordered 支持的事件类型 ParentContextAvailableEventApplicationEvent 支持的事件源 无限制 FileEncodingApplicationListener 结构 implements ApplicationListenerApplicationEnvironmentPreparedEvent, Ordered 支持的事件类型 ApplicationEnvironmentPreparedEventSpringApplicationEventApplicationEvent 支持的事件源 无限制 AnsiOutputApplicationListener 结构 implements ApplicationListenerApplicationEnvironmentPreparedEvent, Ordered 支持的事件类型 ApplicationEnvironmentPreparedEventSpringApplicationEventApplicationEvent 支持的事件源 无限制 DelegatingApplicationListener 结构 implements ApplicationListenerApplicationEvent, Ordered 支持的事件类型 ApplicationEvent 支持的事件源 无限制 LoggingApplicationListener 结构 implements GenericApplicationListener 支持的事件类型 ApplicationStartingEventApplicationEnvironmentPreparedEventApplicationPreparedEventContextClosedEventApplicationFailedEvent 支持的事件源 SpringApplicationApplicationContext EnvironmentPostProcessorApplicationListener 结构 implements SmartApplicationListener, Ordered 支持的事件类型 ApplicationEnvironmentPreparedEventApplicationPreparedEventApplicationFailedEvent 支持的事件源 SpringApplicationApplicationContext BackgroundPreinitializer 结构 implements ApplicationListenerSpringApplicationEvent 支持的事件类型 SpringApplicationEventApplicationEvent 支持的事件源 无限制 事件 从EventPublishingRunListener的方法还有上面的事件类型SpringBoot中的事件类型有 ApplicationStartingEventApplicationEnvironmentPreparedEventApplicationContextInitializedEventApplicationPreparedEventApplicationStartedEventApplicationReadyEvent 除了multicastEvent多播事件还有下面两个方法发布事件。 Override public void started(ConfigurableApplicationContext context, Duration timeTaken) {context.publishEvent(new ApplicationStartedEvent(this.application, this.args, context, timeTaken));AvailabilityChangeEvent.publish(context, LivenessState.CORRECT); }Override public void ready(ConfigurableApplicationContext context, Duration timeTaken) {context.publishEvent(new ApplicationReadyEvent(this.application, this.args, context, timeTaken));AvailabilityChangeEvent.publish(context, ReadinessState.ACCEPTING_TRAFFIC); }事实上这些事件都在一个包路径下。 ApplicationStartingEvent 注释 事件在启动SpringApplication后尽早发布——在Environment或ApplicationContext可用之前但在ApplicationListeners注册之后。事件的来源是SpringApplication本身但要注意在早期阶段不要过多地使用其内部状态因为它可能会在生命周期的后期被修改。 使用的翻译不甚明了得看看怎么这个事件触发后监听器做了什么。 ApplicationEnvironmentPreparedEvent 注释 当SpringApplication启动并且环境首次可用于检查和修改时发布的事件 ApplicationContextInitializedEvent 注释 在启动SpringApplication、准备ApplicationContext和调用ApplicationContextInitializer时发布的事件但在加载任何bean定义之前。 ApplicationPreparedEvent 注释 当SpringApplication正在启动并且ApplicationContext已完全准备好但未刷新时发布的事件。将加载bean定义并且环境已准备好在此阶段使用 ApplicationStartedEvent 注释 刷新应用程序上下文后但在调用任何应用程序和命令行运行程序之前发布的事件 ApplicationReadyEvent 注释 事件尽可能晚地发布以指示应用程序已准备好为请求提供服务。事件的来源是SpringApplication本身但要注意修改其内部状态因为届时所有初始化步骤都已完成 ApplicationFailedEvent 注释 SpringApplication在启动失败时发布的事件
http://www.w-s-a.com/news/720558/

相关文章:

  • 学生如何建设网站网站开发程序
  • 网站建设公司哪家好 皆来磐石网络网站建设"淘宝网" 在颜色选取和搭配方面有哪些值得学习的地方.
  • 网站如何做移动规则适配北京住房与城乡建设部网站
  • 课堂阵地建设网站wordpress运行机制
  • 网站建设的需求方案企业网站建设费用明细
  • 创口贴网站模板京创影视app
  • 团购网站建设目的网站有很多304状态码
  • 运用阿里云怎么做网站外资企业可以在中国境内做网站吗
  • 云南住房和城乡建设局网站西安做官网的公司
  • 企业网站图片上传网站建设和应用的情况
  • 网站不显示内容吗聊城网架公司
  • 南昌网站建设企业网站托管外包怎么做
  • 做非洲外贸的网站网站可以用PS设计吗
  • PHP搭建IDC网站青岛福瀛建设集团网站
  • 安徽网站优化多少钱软件界面设计的基本原则
  • 网站建设动态页面修改删除dnf卖飞机的网站怎么做的
  • 万网是做什么的seo综合
  • 网站关键词分隔符php网站开发平台下载
  • 郑州那家做网站便宜商业计划书免费word版
  • 秦时明月的个人网站怎么做网站开发公司需要招聘哪些人
  • 广告网站建设制作设计服务商安卓app软件定制
  • 公司网站设计与实现中国职业培训在线官方网站
  • 网站服务器空间租用郑州官网网站推广优化
  • 郑州网站建设外包业务wordpress站酷首页
  • 机关门户网站 建设 方案个人怎么申请注册商标
  • 梧州网站建设有哪些九江网站建设优化
  • APP网站建设开发企业发展英文seo招聘
  • 临海市住房和城乡建设规划局网站高校图书馆网站的建设方案
  • 建立门户网站张店易宝网站建设
  • wordpress中英文站点厦门seo顾问屈兴东