Polish
This commit is contained in:
@@ -38,9 +38,7 @@ public class WebEndpointProperties {
|
||||
}
|
||||
|
||||
public void setBasePath(String basePath) {
|
||||
this.basePath = basePath;
|
||||
this.basePath = basePath;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -57,12 +57,12 @@ public class WebMvcEndpointManagementContextConfiguration {
|
||||
@ConditionalOnMissingBean
|
||||
public WebMvcEndpointHandlerMapping webEndpointServletHandlerMapping(
|
||||
EndpointProvider<WebEndpointOperation> provider,
|
||||
EndpointMediaTypes endpointMediaTypes,
|
||||
CorsEndpointProperties corsProperties,
|
||||
EndpointMediaTypes endpointMediaTypes, CorsEndpointProperties corsProperties,
|
||||
WebEndpointProperties webEndpointProperties) {
|
||||
WebMvcEndpointHandlerMapping handlerMapping = new WebMvcEndpointHandlerMapping(
|
||||
new EndpointMapping(webEndpointProperties.getBasePath()),
|
||||
provider.getEndpoints(), endpointMediaTypes, getCorsConfiguration(corsProperties));
|
||||
provider.getEndpoints(), endpointMediaTypes,
|
||||
getCorsConfiguration(corsProperties));
|
||||
return handlerMapping;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,17 +43,18 @@ import org.springframework.web.context.ConfigurableWebApplicationContext;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for the management context. If the
|
||||
* {@code management.server.port} is the same as the {@code server.port} the management context
|
||||
* will be the same as the main application context. If the {@code management.server.port} is
|
||||
* different to the {@code server.port} the management context will be a separate context
|
||||
* that has the main application context as its parent.
|
||||
* {@code management.server.port} is the same as the {@code server.port} the management
|
||||
* context will be the same as the main application context. If the
|
||||
* {@code management.server.port} is different to the {@code server.port} the management
|
||||
* context will be a separate context that has the main application context as its parent.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@Configuration
|
||||
@AutoConfigureOrder(Ordered.LOWEST_PRECEDENCE)
|
||||
@EnableConfigurationProperties({ WebEndpointProperties.class, ManagementServerProperties.class })
|
||||
@EnableConfigurationProperties({ WebEndpointProperties.class,
|
||||
ManagementServerProperties.class })
|
||||
public class ManagementContextAutoConfiguration {
|
||||
|
||||
@Configuration
|
||||
@@ -77,8 +78,8 @@ public class ManagementContextAutoConfiguration {
|
||||
}
|
||||
|
||||
private void verifySslConfiguration() {
|
||||
Boolean enabled = this.environment.getProperty("management.server.ssl.enabled",
|
||||
Boolean.class, false);
|
||||
Boolean enabled = this.environment
|
||||
.getProperty("management.server.ssl.enabled", Boolean.class, false);
|
||||
Assert.state(!enabled,
|
||||
"Management-specific SSL cannot be configured as the management "
|
||||
+ "server is not listening on a separate port");
|
||||
|
||||
@@ -34,4 +34,3 @@ public class WebEndpointPropertiesTests {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -85,8 +85,7 @@ public class WebMvcEndpointIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void endpointsAreSecureWithActuatorRoleWithCustomBasePath()
|
||||
throws Exception {
|
||||
public void endpointsAreSecureWithActuatorRoleWithCustomBasePath() throws Exception {
|
||||
TestSecurityContextHolder.getContext().setAuthentication(
|
||||
new TestingAuthenticationToken("user", "N/A", "ROLE_ACTUATOR"));
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
|
||||
Reference in New Issue
Block a user