我正在阅读SpringApplication的源代码,我发现了两种Listener。
ApplicationListner列表
private List<ApplicationListener<?>> listenersrun方法中,我发现了一个声明为
SpringApplicationRunListeners listeners = getRunListeners(args);他们之间有什么区别?
非常感谢。
发布于 2018-02-07 13:11:28
ApplicationListner -由应用程序事件侦听器实现的接口。
这可能有助于更好地理解什么是spring应用程序https://spring.io/blog/2015/02/11/better-application-events-in-spring-framework-4-2。
SpringApplicationRunListener - SpringApplication run方法的侦听器。将为每次运行创建一个新的SpringApplicationRunListener实例。
Spring应用程序是从Java方法启动的,您通常会在这里执行类似SpringApplication.run(...)的操作。基本上,您可以使用这个接口来处理Spring引导过程事件。
https://stackoverflow.com/questions/48664441
复制相似问题