Class ServerPortInfoApplicationContextInitializer
java.lang.Object
org.springframework.boot.web.context.ServerPortInfoApplicationContextInitializer
- All Implemented Interfaces:
 EventListener,ApplicationContextInitializer<ConfigurableApplicationContext>,ApplicationListener<WebServerInitializedEvent>
public class ServerPortInfoApplicationContextInitializer
extends Object
implements ApplicationContextInitializer<ConfigurableApplicationContext>, ApplicationListener<WebServerInitializedEvent>
ApplicationContextInitializer that sets Environment properties for the
 ports that WebServer servers are actually listening on. The property
 "local.server.port" can be injected directly into tests using
 @Value or obtained through the Environment.
 
 If the WebServerInitializedEvent has a
 server namespace , it will be
 used to construct the property name. For example, the "management" actuator context
 will have the property name "local.management.port".
 
Properties are automatically propagated up to any parent context.
- Since:
 - 2.0.0
 - Author:
 - Dave Syer, Phillip Webb
 
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionvoidinitialize(ConfigurableApplicationContext applicationContext) voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution 
- 
Constructor Details
- 
ServerPortInfoApplicationContextInitializer
public ServerPortInfoApplicationContextInitializer() 
 - 
 - 
Method Details
- 
initialize
- Specified by:
 initializein interfaceApplicationContextInitializer<ConfigurableApplicationContext>
 - 
onApplicationEvent
- Specified by:
 onApplicationEventin interfaceApplicationListener<WebServerInitializedEvent>
 
 -