Class WebServerInitializedEvent
java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
org.springframework.boot.web.context.WebServerInitializedEvent
- All Implemented Interfaces:
- Serializable
- Direct Known Subclasses:
- ReactiveWebServerInitializedEvent,- ServletWebServerInitializedEvent
Event to be published when the 
WebServer is ready. Useful for obtaining the
 local port of a running server.- Since:
- 2.0.0
- Author:
- Brian Clozel, Stephane Nicoll
- See Also:
- 
Field SummaryFields inherited from class java.util.EventObjectsource
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionabstract WebServerApplicationContextAccess the application context that the server was created in.Access the source of the event (anWebServer).Access theWebServer.Methods inherited from class org.springframework.context.ApplicationEventgetTimestampMethods inherited from class java.util.EventObjecttoString
- 
Constructor Details- 
WebServerInitializedEvent
 
- 
- 
Method Details- 
getWebServerAccess theWebServer.- Returns:
- the embedded web server
 
- 
getApplicationContextAccess the application context that the server was created in. Sometimes it is prudent to check that this matches expectations (like being equal to the current context) before acting on the server itself.- Returns:
- the applicationContext that the server was created from
 
- 
getSourceAccess the source of the event (anWebServer).- Overrides:
- getSourcein class- EventObject
- Returns:
- the embedded web server
 
 
-