Class EmbeddedServletContainerInitializedEvent
- java.lang.Object
- java.util.EventObject
- org.springframework.context.ApplicationEvent
- org.springframework.boot.context.embedded.EmbeddedServletContainerInitializedEvent
- All Implemented Interfaces:
Serializable
public class EmbeddedServletContainerInitializedEvent extends org.springframework.context.ApplicationEvent
Event to be published after the context is refreshed and theEmbeddedServletContainer
is ready. Useful for obtaining the local port of a running server. Normally it will have been started, but listeners are free to inspect the server and stop and start it if they want to.- See Also:
- Serialized Form
Field Summary
Fields inherited from class java.util.EventObject
source
Constructor Summary
Constructors Constructor Description EmbeddedServletContainerInitializedEvent(EmbeddedWebApplicationContext applicationContext, EmbeddedServletContainer source)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EmbeddedWebApplicationContext
getApplicationContext()
Access the application context that the container was created in.EmbeddedServletContainer
getEmbeddedServletContainer()
Access theEmbeddedServletContainer
.EmbeddedServletContainer
getSource()
Access the source of the event (anEmbeddedServletContainer
).Methods inherited from class java.util.EventObject
toString
Constructor Detail
EmbeddedServletContainerInitializedEvent
public EmbeddedServletContainerInitializedEvent(EmbeddedWebApplicationContext applicationContext, EmbeddedServletContainer source)
Method Detail
getEmbeddedServletContainer
public EmbeddedServletContainer getEmbeddedServletContainer()
Access theEmbeddedServletContainer
.- Returns:
- the embedded servlet container
getSource
public EmbeddedServletContainer getSource()
Access the source of the event (anEmbeddedServletContainer
).- Overrides:
getSource
in classEventObject
- Returns:
- the embedded servlet container
getApplicationContext
public EmbeddedWebApplicationContext getApplicationContext()
Access the application context that the container 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 container itself.- Returns:
- the applicationContext that the container was created from