Browse Source

Merge pull request #11811 from izeye:polish-20180127-2nd

* pr/11811:
  Polish contribution
  Polish
pull/11825/head
Stephane Nicoll 8 years ago
parent
commit
3c1f7abbbe
  1. 2
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/jolokia/JolokiaEndpoint.java
  2. 4
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextConfigurationImportSelector.java
  3. 3
      spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/servlet/WebMvcEndpointChildContextConfiguration.java
  4. 5
      spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JolokiaEndpointAutoConfigurationIntegrationTests.java
  5. 4
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java
  6. 2
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/DiscoveredServletEndpoint.java
  7. 2
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointDiscoverer.java
  8. 2
      spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java
  9. 18
      spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/EndpointServletTests.java
  10. 8
      spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc

2
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/jolokia/JolokiaEndpoint.java

@ -34,7 +34,7 @@ import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint; @@ -34,7 +34,7 @@ import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint;
@ServletEndpoint(id = "jolokia")
public class JolokiaEndpoint implements Supplier<EndpointServlet> {
private Map<String, String> initParameters;
private final Map<String, String> initParameters;
public JolokiaEndpoint(Map<String, String> initParameters) {
this.initParameters = initParameters;

4
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextConfigurationImportSelector.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -36,7 +36,7 @@ import org.springframework.core.type.classreading.SimpleMetadataReaderFactory; @@ -36,7 +36,7 @@ import org.springframework.core.type.classreading.SimpleMetadataReaderFactory;
/**
* Selects configuration classes for the management context configuration. Entries are
* loaded from {@code /META-INF/spring.factories} under the
* {@code org.springframework.boot.actuate.autoconfigure.ManagementContextConfiguration}
* {@code org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration}
* key.
*
* @author Dave Syer

3
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/servlet/WebMvcEndpointChildContextConfiguration.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -36,7 +36,6 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc; @@ -36,7 +36,6 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
* @author Stephane Nicoll
* @author Andy Wilkinson
* @author Phillip Webb
* @since 2.0.0
*/
@ManagementContextConfiguration(ManagementContextType.CHILD)
@ConditionalOnWebApplication(type = Type.SERVLET)

5
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JolokiaManagementContextConfigurationIntegrationTests.java → spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JolokiaEndpointAutoConfigurationIntegrationTests.java

@ -29,7 +29,6 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -29,7 +29,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.endpoint.web.ServletEndpointManagementContextConfiguration;
import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.jolokia.JolokiaEndpoint;
import org.springframework.boot.actuate.autoconfigure.jolokia.JolokiaEndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementContextAutoConfiguration;
@ -55,7 +54,7 @@ import org.springframework.test.context.junit4.SpringRunner; @@ -55,7 +54,7 @@ import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Integration tests for {@link JolokiaEndpoint}.
* Integration tests for {@link JolokiaEndpointAutoConfiguration}.
*
* @author Stephane Nicoll
*/
@ -63,7 +62,7 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -63,7 +62,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@DirtiesContext
@TestPropertySource(properties = "management.endpoints.web.expose=jolokia")
public class JolokiaManagementContextConfigurationIntegrationTests {
public class JolokiaEndpointAutoConfigurationIntegrationTests {
@Autowired
private TestRestTemplate restTemplate;

4
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java

@ -29,8 +29,8 @@ import org.springframework.boot.web.servlet.ServletContextInitializer; @@ -29,8 +29,8 @@ import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.util.Assert;
/**
* {@link ServletContextInitializer} to register {@link ExposableServletEndpoint} servlet
* endpoints.
* {@link ServletContextInitializer} to register {@link ExposableServletEndpoint servlet
* endpoints}.
*
* @author Phillip Webb
* @since 2.0.0

2
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/DiscoveredServletEndpoint.java

@ -46,7 +46,7 @@ class DiscoveredServletEndpoint extends AbstractDiscoveredEndpoint<Operation> @@ -46,7 +46,7 @@ class DiscoveredServletEndpoint extends AbstractDiscoveredEndpoint<Operation>
() -> "ServletEndpoint bean " + beanType + " must be a supplier");
Object supplied = ((Supplier<?>) endpointBean).get();
Assert.state(supplied != null,
"ServletEndpoint bean " + beanType + " must not supply null");
() -> "ServletEndpoint bean " + beanType + " must not supply null");
Assert.state(supplied instanceof EndpointServlet, () -> "ServletEndpoint bean "
+ beanType + " must supply an EndpointServlet");
this.endpointServlet = (EndpointServlet) supplied;

2
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointDiscoverer.java

@ -44,7 +44,7 @@ public class ServletEndpointDiscoverer @@ -44,7 +44,7 @@ public class ServletEndpointDiscoverer
private final PathMapper endpointPathMapper;
/**
* Create a new {@link ServletEndpointFilter} instance.
* Create a new {@link ServletEndpointDiscoverer} instance.
* @param applicationContext the source application context
* @param endpointPathMapper the endpoint path mapper
* @param filters filters to apply

2
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java

@ -83,7 +83,7 @@ public class WebMvcMetricsFilter extends OncePerRequestFilter { @@ -83,7 +83,7 @@ public class WebMvcMetricsFilter extends OncePerRequestFilter {
* Create a new {@link WebMvcMetricsFilter} instance.
* @param context the source application context
* @param registry the meter registry
* @param tagsProvider the tags provier
* @param tagsProvider the tags provider
* @param metricName the metric name
* @param autoTimeRequests if requests should be automatically timed
*/

18
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/EndpointServletTests.java

@ -76,14 +76,14 @@ public class EndpointServletTests { @@ -76,14 +76,14 @@ public class EndpointServletTests {
public void withInitParameterNullName() {
EndpointServlet endpointServlet = new EndpointServlet(TestServlet.class);
this.thrown.expect(IllegalArgumentException.class);
endpointServlet.withInitParameters(Collections.singletonMap(null, "value"));
endpointServlet.withInitParameter(null, "value");
}
@Test
public void withInitParameterEmptyName() {
EndpointServlet endpointServlet = new EndpointServlet(TestServlet.class);
this.thrown.expect(IllegalArgumentException.class);
endpointServlet.withInitParameters(Collections.singletonMap(" ", "value"));
endpointServlet.withInitParameter(" ", "value");
}
@Test
@ -102,6 +102,20 @@ public class EndpointServletTests { @@ -102,6 +102,20 @@ public class EndpointServletTests {
entry("a", "b1"), entry("c", "d"), entry("e", "f"));
}
@Test
public void withInitParametersNullName() {
EndpointServlet endpointServlet = new EndpointServlet(TestServlet.class);
this.thrown.expect(IllegalArgumentException.class);
endpointServlet.withInitParameters(Collections.singletonMap(null, "value"));
}
@Test
public void withInitParametersEmptyName() {
EndpointServlet endpointServlet = new EndpointServlet(TestServlet.class);
this.thrown.expect(IllegalArgumentException.class);
endpointServlet.withInitParameters(Collections.singletonMap(" ", "value"));
}
@Test
public void withInitParametersShouldCreateNewInstance() {
EndpointServlet endpointServlet = new EndpointServlet(TestServlet.class);

8
spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc

@ -500,9 +500,9 @@ to augment an existing endpoint. @@ -500,9 +500,9 @@ to augment an existing endpoint.
TIP: If you add endpoints as a library feature, consider adding a configuration class
annotated with `@ManagementContextConfiguration` to `/META-INF/spring.factories` under the
following key:
`org.springframework.boot.actuate.autoconfigure.ManagementContextConfiguration`. If you do
so and if your users ask for a separate management port or address, the endpoint moves to
a child context with all the other web endpoints.
`org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration`. If
you do so and if your users ask for a separate management port or address, the endpoint
moves to a child context with all the other web endpoints.
@ -1014,7 +1014,7 @@ Maven, you would add the following dependency: @@ -1014,7 +1014,7 @@ Maven, you would add the following dependency:
----
The Jolokia endpoint can then be exposed by adding `jolokia` or `*` to the
`management.endpoints.web.expose` property. You can then be accessed it by using
`management.endpoints.web.expose` property. You can then access it by using
`/actuator/jolokia` on your management HTTP server.

Loading…
Cancel
Save