类 WebServerInitializedEvent

java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
org.springframework.boot.web.context.WebServerInitializedEvent
所有已实现的接口:
Serializable
直接已知子类:
ReactiveWebServerInitializedEvent, ServletWebServerInitializedEvent

public abstract class WebServerInitializedEvent extends ApplicationEvent
Event to be published when the WebServer is ready. Useful for obtaining the local port of a running server.
从以下版本开始:
2.0.0
作者:
Brian Clozel, Stephane Nicoll
另请参阅:
  • 构造器详细资料

    • WebServerInitializedEvent

      protected WebServerInitializedEvent(WebServer webServer)
  • 方法详细资料

    • getWebServer

      public WebServer getWebServer()
      Access the WebServer.
      返回:
      the embedded web server
    • getApplicationContext

      public abstract WebServerApplicationContext 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.
      返回:
      the applicationContext that the server was created from
    • getSource

      public WebServer getSource()
      Access the source of the event (an WebServer).
      覆盖:
      getSource 在类中 EventObject
      返回:
      the embedded web server