diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/jolokia/JolokiaEndpoint.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/jolokia/JolokiaEndpoint.java index 49c23893fb..6f56f6281e 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/jolokia/JolokiaEndpoint.java +++ b/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; @ServletEndpoint(id = "jolokia") public class JolokiaEndpoint implements Supplier { - private Map initParameters; + private final Map initParameters; public JolokiaEndpoint(Map initParameters) { this.initParameters = initParameters; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextConfigurationImportSelector.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextConfigurationImportSelector.java index 22e58d1f30..d665e37c47 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextConfigurationImportSelector.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementContextConfigurationImportSelector.java @@ -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; /** * 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 diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/servlet/WebMvcEndpointChildContextConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/servlet/WebMvcEndpointChildContextConfiguration.java index baa6ae0ebc..d96ffdae51 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/servlet/WebMvcEndpointChildContextConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/servlet/WebMvcEndpointChildContextConfiguration.java @@ -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; * @author Stephane Nicoll * @author Andy Wilkinson * @author Phillip Webb - * @since 2.0.0 */ @ManagementContextConfiguration(ManagementContextType.CHILD) @ConditionalOnWebApplication(type = Type.SERVLET) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JolokiaManagementContextConfigurationIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JolokiaEndpointAutoConfigurationIntegrationTests.java similarity index 96% rename from spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JolokiaManagementContextConfigurationIntegrationTests.java rename to spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JolokiaEndpointAutoConfigurationIntegrationTests.java index c6ca06f0fd..4e476afc78 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JolokiaManagementContextConfigurationIntegrationTests.java +++ b/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; 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; 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; @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext @TestPropertySource(properties = "management.endpoints.web.expose=jolokia") -public class JolokiaManagementContextConfigurationIntegrationTests { +public class JolokiaEndpointAutoConfigurationIntegrationTests { @Autowired private TestRestTemplate restTemplate; diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java index 72878a1f16..c2973caac9 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/ServletEndpointRegistrar.java +++ b/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; 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 diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/DiscoveredServletEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/DiscoveredServletEndpoint.java index dd9c89fac5..7efca5abc5 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/DiscoveredServletEndpoint.java +++ b/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 () -> "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; diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointDiscoverer.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointDiscoverer.java index a8b3405c1c..0b9b5ccf96 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/web/annotation/ServletEndpointDiscoverer.java +++ b/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 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 diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java index 9fbf67c083..e24e0414e2 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java +++ b/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 { * 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 */ diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/EndpointServletTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/EndpointServletTests.java index 77a65d62d0..58caf16d50 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/EndpointServletTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/endpoint/web/EndpointServletTests.java @@ -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 { 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); diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc index dd7efcf922..df387a223b 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc @@ -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: ---- 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.