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
public abstract class WebServerInitializedEvent
extends org.springframework.context.ApplicationEvent
Event to be published when the
WebServer
is ready. Useful for obtaining the
local port of a running server.- Since:
- 2.0.0
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract WebServerApplicationContext
Access 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.ApplicationEvent
getTimestamp
Methods inherited from class java.util.EventObject
toString
-
Constructor Details
-
WebServerInitializedEvent
-
-
Method Details
-
getWebServer
Access theWebServer
.- Returns:
- the embedded web server
-
getApplicationContext
Access 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
-
getSource
Access the source of the event (anWebServer
).- Overrides:
getSource
in classEventObject
- Returns:
- the embedded web server
-