类 ServerPortInfoApplicationContextInitializer

  • 所有已实现的接口:
    org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext>

    public class ServerPortInfoApplicationContextInitializer
    extends Object
    implements org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext>
    ApplicationContextInitializer that sets Environment properties for the ports that EmbeddedServletContainer servers are actually listening on. The property "local.server.port" can be injected directly into tests using @Value or obtained via the Environment.

    If the EmbeddedWebApplicationContext has a namespace set, 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.

    从以下版本开始:
    1.4.0