You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are some behavior changes in Spring Boot 2.3.0. This issue #21325 commit introduced new Web Server lifecycle logic - WebServerStartStopLifecycle. And now there is this order during an applicaton startup:
We run some logic after the Spring context has been initialized but before web server started. With Spring Boot 2.3.0 web server processes requests before this logic is done.
If it is an expected change of events order, it should be mentioned in migration guide.
The text was updated successfully, but these errors were encountered:
It is expected, but it looks like we have a bit of tidying up to do after that change, both in the migration guide and in a few places in the code. Thanks for letting us know.
wilkinsona
changed the title
2.3.0 behavior change: Web server starts now before ContextRefreshedEvent
Update documentation to reflect the web server now being started immediately before the ContextRefreshedEvent is published
Jul 9, 2020
@wilkinsona thanks for your answer.
Is there another possibility to run some code after context has been initialized but before web server started? Should there be some other extension point for this?
Generally, we expect that sort of work to be done as part of the usual bean lifecycle. There are lots of different options depending on exactly what you want to do. For example, the code could be run:
as part of a bean's construction
in a @PostConstruct method
in afterPropertiesSet() having implemented InitializingBean
in start() having implemented Lifecycle or SmartLifecycle
There are some behavior changes in Spring Boot 2.3.0. This issue #21325 commit introduced new Web Server lifecycle logic - WebServerStartStopLifecycle. And now there is this order during an applicaton startup:
In Spring Boot 2.2.0 there was another logic (ServletWebServerApplicationContext.java):
And order was like this:
We run some logic after the Spring context has been initialized but before web server started. With Spring Boot 2.3.0 web server processes requests before this logic is done.
If it is an expected change of events order, it should be mentioned in migration guide.
The text was updated successfully, but these errors were encountered: