Update WebServerInitEvent docs to reflect ordering w.r.t. refresh

Closes gh-22277
This commit is contained in:
Andy Wilkinson 2020-07-13 12:51:07 +01:00
parent f18b657ff9
commit f52cdf10b3
4 changed files with 11 additions and 13 deletions

View File

@ -319,9 +319,9 @@ Application events are sent in the following order, as your application runs:
The above list only includes ``SpringApplicationEvent``s that are tied to a `SpringApplication`.
In addition to these, the following events are also published after `ApplicationPreparedEvent` and before `ApplicationStartedEvent`:
. A `ContextRefreshedEvent` is sent when an `ApplicationContext` is refreshed.
. A `WebServerInitializedEvent` is sent after the `WebServer` is ready.
- A `WebServerInitializedEvent` is sent after the `WebServer` is ready.
`ServletWebServerInitializedEvent` and `ReactiveWebServerInitializedEvent` are the servlet and reactive variants respectively.
- A `ContextRefreshedEvent` is sent when an `ApplicationContext` is refreshed.
TIP: You often need not use application events, but it can be handy to know that they exist.
Internally, Spring Boot uses events to handle a variety of tasks.

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -20,8 +20,8 @@ import org.springframework.boot.web.server.WebServer;
import org.springframework.context.ApplicationEvent;
/**
* Event to be published after the application context is refreshed and the
* {@link WebServer} is ready. Useful for obtaining the local port of a running server.
* Event to be published when the {@link WebServer} is ready. Useful for obtaining the
* local port of a running server.
*
* @author Brian Clozel
* @author Stephane Nicoll

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -20,9 +20,8 @@ import org.springframework.boot.web.context.WebServerInitializedEvent;
import org.springframework.boot.web.server.WebServer;
/**
* Event to be published after the {@link ReactiveWebServerApplicationContext} is
* refreshed and the {@link WebServer} is ready. Useful for obtaining the local port of a
* running server.
* Event to be published after the {@link WebServer} is ready. Useful for obtaining the
* local port of a running server.
*
* @author Brian Clozel
* @author Stephane Nicoll

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -20,9 +20,8 @@ import org.springframework.boot.web.context.WebServerInitializedEvent;
import org.springframework.boot.web.server.WebServer;
/**
* Event to be published after the {@link ServletWebServerApplicationContext} is refreshed
* and the {@link WebServer} is ready. Useful for obtaining the local port of a running
* server.
* Event to be published after the {@link WebServer} is ready. Useful for obtaining the
* local port of a running server.
*
* <p>
* Normally it will have been started, but listeners are free to inspect the server and