Class WebServerInitializedEvent
java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
org.springframework.boot.web.server.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:
- 4.0.0
- Author:
- Brian Clozel, Stephane Nicoll
- See Also:
- 
Field SummaryFields inherited from class 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 ApplicationEventgetTimestampMethods inherited from class EventObjecttoString
- 
Constructor Details- 
WebServerInitializedEvent
 
- 
- 
Method Details- 
getWebServer
- 
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
 
 
-