gpt4 book ai didi

java - 每次调用 ContextRefreshedEvent 而不是 ContextStartedEvent

转载 作者:行者123 更新时间:2023-11-29 08:41:28 24 4
gpt4 key购买 nike

我正在尝试 ApplicationListener,但每次都会调用 ContextRefreshedEvent。我想知道何时调用 ContextStartedEvent

public class CustomListener implements ApplicationListener{

@Override
public void onApplicationEvent(ApplicationEvent applicationEvent) {
if(applicationEvent instanceof ContextRefreshedEvent){
System.out.println("<><><>refresh event......");
}else if(applicationEvent instanceof ContextStartedEvent){
System.out.println("<><><><>started event......");
}else{
System.out.println("......else........");
}
}

}

最佳答案

关于java - 每次调用 ContextRefreshedEvent 而不是 ContextStartedEvent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39846314/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com