Add WebServerBeforeStartEvent before web server start. It is useful in some business scenarios, we need to do some perception and necessary initialization work before the web server starts.
Comment From: pivotal-cla
@weiwei121723 Please sign the Contributor License Agreement!
Click here to manually synchronize the status of this Pull Request.
See the FAQ for frequently asked questions.
Comment From: pivotal-cla
@weiwei121723 Thank you for signing the Contributor License Agreement!
Comment From: philwebb
Thanks for the pull request. Before we consider merging this do any of the existing event provide what you need? For example ApplicationContextInitializedEvent or ApplicationPreparedEvent?
If we do add a BeforeServletWebServerInitializedEvent, I don't think that it should extends ServletWebServerInitializedEvent since that event is for when a web server is ready.
Comment From: weiwei121723
thanks @philwebb ,
In my project, I try to use the ApplicationPreparedEvent to do some initialization work, but it seems not to prevent the web server start. And ApplicationContextInitializedEvent is not invoked.
it should extends ServletWebServerInitializedEvent since that even is for when a web server is ready.
This point is very correct, I will reconsider this question about the event.
Thanks for your replay
Comment From: philwebb
@weiwei121723 We discussed this today as a team and decided that we need a stronger use-case before we can consider adding a new event. There are several existing mechanisms that we feel should work and we'd like to prove that they won't before we offer another.
If you feel you have a real use-case that you can't get working with existing mechanisms then please open a new issue and attach a full application that we can run and debug. We're a little confused about how the ApplicationPreparedEvent is working on the snippet of code you shared so a full application is really needed.
Regardless, thanks for working on the pull-request.