SpringBoot 启动挂载点说明 对应Spring应用事件监听

 

SpringBoot应用启动过程挂载点与Spring事件监听对应如下表:

starting				ApplicationStartingEvent
environmentPrepared     ApplicationEnvironmentPreparedEvent
contextPrepared         ApplicationContextInitializedEvent
contextLoaded           ApplicationPreparedEvent
started                 ApplicationStartedEvent
running					ApplicationReadyEvent
failed					ApplicationFailedEvent

  

Spring中注册监听事件:

@Component
public class AppListener implements ApplicationListener<ApplicationReadyEvent> {
    @Override
    public void onApplicationEvent(ApplicationReadyEvent event) {
        System.out.println("SPRING BOOT READY!!!");
    }
}

  

 

posted @ 2020-01-19 10:52  GordonDicaprio  阅读(241)  评论(0编辑  收藏