@ -16,6 +16,7 @@
@@ -16,6 +16,7 @@
package org.springframework.boot.actuate.autoconfigure ;
import java.util.Collections ;
import java.util.HashSet ;
import java.util.Set ;
@ -36,6 +37,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
@@ -36,6 +37,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.SearchStrategy ;
import org.springframework.boot.autoconfigure.web.ErrorAttributes ;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters ;
import org.springframework.boot.autoconfigure.web.ServerProperties ;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer ;
import org.springframework.boot.context.embedded.EmbeddedServletContainer ;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer ;
@ -75,13 +77,23 @@ public class EndpointWebMvcChildContextConfiguration {
@@ -75,13 +77,23 @@ public class EndpointWebMvcChildContextConfiguration {
// instances get their callback very early in the context lifecycle.
private ManagementServerProperties managementServerProperties ;
private ServerProperties server ;
@Override
public void customize ( ConfigurableEmbeddedServletContainer container ) {
if ( this . managementServerProperties = = null ) {
this . managementServerProperties = BeanFactoryUtils
. beanOfTypeIncludingAncestors ( this . beanFactory ,
ManagementServerProperties . class ) ;
this . server = BeanFactoryUtils
. beanOfTypeIncludingAncestors ( this . beanFactory ,
ServerProperties . class ) ;
}
// Customize as per the parent context first (so e.g. the access logs go to the same place)
server . customize ( container ) ;
// Then reset the error pages
container . setErrorPages ( Collections . < ErrorPage > emptySet ( ) ) ;
// and add the management-specific bits
container . setPort ( this . managementServerProperties . getPort ( ) ) ;
container . setAddress ( this . managementServerProperties . getAddress ( ) ) ;
container . setContextPath ( this . managementServerProperties . getContextPath ( ) ) ;