From 758ddcd420df0853926579f932c9a4365a1de216 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 11 Apr 2017 20:17:09 -0700 Subject: [PATCH] Polish --- .../actuate/health/SolrHealthIndicator.java | 11 +- .../actuate/trace/WebRequestTraceFilter.java | 10 +- .../health/SolrHealthIndicatorTests.java | 6 +- ...reeMarkerTemplateAvailabilityProvider.java | 58 +++------ .../GroovyTemplateAvailabilityProvider.java | 59 +++------- .../AbstractTemplateAvailabilityProvider.java | 110 ++++++++++++++++++ .../VelocityTemplateAvailabilityProvider.java | 58 +++------ .../web/ServerPropertiesTests.java | 9 +- .../asciidoc/production-ready-features.adoc | 62 +++++----- .../SampleActuatorApplicationTests.java | 4 +- 10 files changed, 204 insertions(+), 183 deletions(-) create mode 100644 spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractTemplateAvailabilityProvider.java diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/SolrHealthIndicator.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/SolrHealthIndicator.java index 21d5f7f4a14..25d89c27434 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/SolrHealthIndicator.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/SolrHealthIndicator.java @@ -41,13 +41,10 @@ public class SolrHealthIndicator extends AbstractHealthIndicator { CoreAdminRequest request = new CoreAdminRequest(); request.setAction(CoreAdminParams.CoreAdminAction.STATUS); CoreAdminResponse response = request.process(this.solrClient); - int status = response.getStatus(); - if (status == 0) { - builder.up().withDetail("solrStatus", "OK"); - } - else { - builder.down().withDetail("solrStatus", status); - } + int statusCode = response.getStatus(); + Status status = (statusCode == 0 ? Status.UP : Status.DOWN); + builder.status(status).withDetail("solrStatus", + (statusCode == 0 ? "OK" : statusCode)); } } diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java index ae00f073855..c8c4316c118 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/WebRequestTraceFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -132,7 +132,7 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order add(trace, Include.USER_PRINCIPAL, "userPrincipal", (userPrincipal == null ? null : userPrincipal.getName())); if (isIncluded(Include.PARAMETERS)) { - trace.put("parameters", getParameterMap(request)); + trace.put("parameters", getParameterMapCopy(request)); } add(trace, Include.QUERY_STRING, "query", request.getQueryString()); add(trace, Include.AUTH_TYPE, "authType", request.getAuthType()); @@ -170,10 +170,8 @@ public class WebRequestTraceFilter extends OncePerRequestFilter implements Order return headers; } - private Map getParameterMap(HttpServletRequest request) { - Map map = new LinkedHashMap(); - map.putAll(request.getParameterMap()); - return map; + private Map getParameterMapCopy(HttpServletRequest request) { + return new LinkedHashMap(request.getParameterMap()); } /** diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/SolrHealthIndicatorTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/SolrHealthIndicatorTests.java index ef41165120b..2fae2534e57 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/SolrHealthIndicatorTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/SolrHealthIndicatorTests.java @@ -68,7 +68,7 @@ public class SolrHealthIndicatorTests { public void solrIsUp() throws Exception { SolrClient solrClient = mock(SolrClient.class); given(solrClient.request(any(CoreAdminRequest.class), (String) isNull())) - .willReturn(mockResponse(0)); + .willReturn(mockResponse(0)); SolrHealthIndicator healthIndicator = new SolrHealthIndicator(solrClient); Health health = healthIndicator.health(); assertThat(health.getStatus()).isEqualTo(Status.UP); @@ -79,7 +79,7 @@ public class SolrHealthIndicatorTests { public void solrIsUpAndRequestFailed() throws Exception { SolrClient solrClient = mock(SolrClient.class); given(solrClient.request(any(CoreAdminRequest.class), (String) isNull())) - .willReturn(mockResponse(400)); + .willReturn(mockResponse(400)); SolrHealthIndicator healthIndicator = new SolrHealthIndicator(solrClient); Health health = healthIndicator.health(); assertThat(health.getStatus()).isEqualTo(Status.DOWN); @@ -90,7 +90,7 @@ public class SolrHealthIndicatorTests { public void solrIsDown() throws Exception { SolrClient solrClient = mock(SolrClient.class); given(solrClient.request(any(CoreAdminRequest.class), (String) isNull())) - .willThrow(new IOException("Connection failed")); + .willThrow(new IOException("Connection failed")); SolrHealthIndicator healthIndicator = new SolrHealthIndicator(solrClient); Health health = healthIndicator.health(); assertThat(health.getStatus()).isEqualTo(Status.DOWN); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProvider.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProvider.java index e011c66d0c5..041e0ebff1b 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProvider.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProvider.java @@ -20,13 +20,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.springframework.boot.autoconfigure.template.AbstractTemplateAvailabilityProvider; import org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider; -import org.springframework.boot.bind.PropertySourcesPropertyValues; -import org.springframework.boot.bind.RelaxedDataBinder; -import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.Environment; -import org.springframework.core.io.ResourceLoader; -import org.springframework.util.ClassUtils; /** * {@link TemplateAvailabilityProvider} that provides availability information for @@ -36,35 +31,28 @@ import org.springframework.util.ClassUtils; * @since 1.1.0 */ public class FreeMarkerTemplateAvailabilityProvider - implements TemplateAvailabilityProvider { + extends AbstractTemplateAvailabilityProvider { - @Override - public boolean isTemplateAvailable(String view, Environment environment, - ClassLoader classLoader, ResourceLoader resourceLoader) { - if (ClassUtils.isPresent("freemarker.template.Configuration", classLoader)) { - FreeMarkerTemplateAvailabilityProperties properties = new FreeMarkerTemplateAvailabilityProperties(); - RelaxedDataBinder binder = new RelaxedDataBinder(properties, - "spring.freemarker"); - binder.bind(new PropertySourcesPropertyValues( - ((ConfigurableEnvironment) environment).getPropertySources())); - for (String loaderPath : properties.getTemplateLoaderPath()) { - if (resourceLoader.getResource(loaderPath + properties.getPrefix() + view - + properties.getSuffix()).exists()) { - return true; - } - } - } - return false; + public FreeMarkerTemplateAvailabilityProvider() { + super("freemarker.template.Configuration", + FreeMarkerTemplateAvailabilityProperties.class, "spring.freemarker"); } - static final class FreeMarkerTemplateAvailabilityProperties { + static final class FreeMarkerTemplateAvailabilityProperties + extends TemplateAvailabilityProperties { private List templateLoaderPath = new ArrayList( Arrays.asList(FreeMarkerProperties.DEFAULT_TEMPLATE_LOADER_PATH)); - private String prefix = FreeMarkerProperties.DEFAULT_PREFIX; + FreeMarkerTemplateAvailabilityProperties() { + super(FreeMarkerProperties.DEFAULT_PREFIX, + FreeMarkerProperties.DEFAULT_SUFFIX); + } - private String suffix = FreeMarkerProperties.DEFAULT_SUFFIX; + @Override + protected List getLoaderPath() { + return this.templateLoaderPath; + } public List getTemplateLoaderPath() { return this.templateLoaderPath; @@ -74,22 +62,6 @@ public class FreeMarkerTemplateAvailabilityProvider this.templateLoaderPath = templateLoaderPath; } - public String getPrefix() { - return this.prefix; - } - - public void setPrefix(String prefix) { - this.prefix = prefix; - } - - public String getSuffix() { - return this.suffix; - } - - public void setSuffix(String suffix) { - this.suffix = suffix; - } - } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAvailabilityProvider.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAvailabilityProvider.java index 363fffae9e5..9039eea10f3 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAvailabilityProvider.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAvailabilityProvider.java @@ -20,13 +20,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.springframework.boot.autoconfigure.template.AbstractTemplateAvailabilityProvider; import org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider; -import org.springframework.boot.bind.PropertySourcesPropertyValues; -import org.springframework.boot.bind.RelaxedDataBinder; -import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.Environment; -import org.springframework.core.io.ResourceLoader; -import org.springframework.util.ClassUtils; /** * {@link TemplateAvailabilityProvider} that provides availability information for Groovy @@ -35,35 +30,29 @@ import org.springframework.util.ClassUtils; * @author Dave Syer * @since 1.1.0 */ -public class GroovyTemplateAvailabilityProvider implements TemplateAvailabilityProvider { +public class GroovyTemplateAvailabilityProvider + extends AbstractTemplateAvailabilityProvider { - @Override - public boolean isTemplateAvailable(String view, Environment environment, - ClassLoader classLoader, ResourceLoader resourceLoader) { - if (ClassUtils.isPresent("groovy.text.TemplateEngine", classLoader)) { - GroovyTemplateAvailabilityProperties properties = new GroovyTemplateAvailabilityProperties(); - RelaxedDataBinder binder = new RelaxedDataBinder(properties, - "spring.groovy.template"); - binder.bind(new PropertySourcesPropertyValues( - ((ConfigurableEnvironment) environment).getPropertySources())); - for (String loaderPath : properties.getResourceLoaderPath()) { - if (resourceLoader.getResource(loaderPath + properties.getPrefix() + view - + properties.getSuffix()).exists()) { - return true; - } - } - } - return false; + public GroovyTemplateAvailabilityProvider() { + super("groovy.text.TemplateEngine", GroovyTemplateAvailabilityProperties.class, + "spring.groovy.template"); } - static final class GroovyTemplateAvailabilityProperties { + static final class GroovyTemplateAvailabilityProperties + extends TemplateAvailabilityProperties { private List resourceLoaderPath = new ArrayList( Arrays.asList(GroovyTemplateProperties.DEFAULT_RESOURCE_LOADER_PATH)); - private String prefix = GroovyTemplateProperties.DEFAULT_PREFIX; + GroovyTemplateAvailabilityProperties() { + super(GroovyTemplateProperties.DEFAULT_PREFIX, + GroovyTemplateProperties.DEFAULT_SUFFIX); + } - private String suffix = GroovyTemplateProperties.DEFAULT_SUFFIX; + @Override + protected List getLoaderPath() { + return this.resourceLoaderPath; + } public List getResourceLoaderPath() { return this.resourceLoaderPath; @@ -73,22 +62,6 @@ public class GroovyTemplateAvailabilityProvider implements TemplateAvailabilityP this.resourceLoaderPath = resourceLoaderPath; } - public String getPrefix() { - return this.prefix; - } - - public void setPrefix(String prefix) { - this.prefix = prefix; - } - - public String getSuffix() { - return this.suffix; - } - - public void setSuffix(String suffix) { - this.suffix = suffix; - } - } } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractTemplateAvailabilityProvider.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractTemplateAvailabilityProvider.java new file mode 100644 index 00000000000..52134122c0d --- /dev/null +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractTemplateAvailabilityProvider.java @@ -0,0 +1,110 @@ +/* + * Copyright 2012-2017 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.autoconfigure.template; + +import java.util.List; + +import org.springframework.beans.BeanUtils; +import org.springframework.boot.bind.PropertySourcesPropertyValues; +import org.springframework.boot.bind.RelaxedDataBinder; +import org.springframework.core.env.ConfigurableEnvironment; +import org.springframework.core.env.Environment; +import org.springframework.core.io.ResourceLoader; +import org.springframework.util.ClassUtils; + +/** + * Abstract base class for {@link TemplateAvailabilityProvider} implementations. + * + * @author Andy Wilkinson + * @author Phillip Webb + * @since 1.4.6 + */ +public abstract class AbstractTemplateAvailabilityProvider + implements TemplateAvailabilityProvider { + + private final String className; + + private final Class propertiesClass; + + private final String propertyPrefix; + + public AbstractTemplateAvailabilityProvider(String className, + Class propertiesClass, + String propertyPrefix) { + this.className = className; + this.propertiesClass = propertiesClass; + this.propertyPrefix = propertyPrefix; + } + + @Override + public boolean isTemplateAvailable(String view, Environment environment, + ClassLoader classLoader, ResourceLoader resourceLoader) { + if (ClassUtils.isPresent(this.className, classLoader)) { + TemplateAvailabilityProperties properties = BeanUtils + .instantiateClass(this.propertiesClass); + RelaxedDataBinder binder = new RelaxedDataBinder(properties, + this.propertyPrefix); + binder.bind(new PropertySourcesPropertyValues( + ((ConfigurableEnvironment) environment).getPropertySources())); + return isTemplateAvailable(view, resourceLoader, properties); + } + return false; + } + + private boolean isTemplateAvailable(String view, ResourceLoader resourceLoader, + TemplateAvailabilityProperties properties) { + String location = properties.getPrefix() + view + properties.getSuffix(); + for (String path : properties.getLoaderPath()) { + if (resourceLoader.getResource(path + location).exists()) { + return true; + } + } + return false; + } + + protected static abstract class TemplateAvailabilityProperties { + + private String prefix; + + private String suffix; + + protected TemplateAvailabilityProperties(String prefix, String suffix) { + this.prefix = prefix; + this.suffix = suffix; + } + + protected abstract List getLoaderPath(); + + public String getPrefix() { + return this.prefix; + } + + public void setPrefix(String prefix) { + this.prefix = prefix; + } + + public String getSuffix() { + return this.suffix; + } + + public void setSuffix(String suffix) { + this.suffix = suffix; + } + + } + +} diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProvider.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProvider.java index 8253ef76b31..37e71ae8a4a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProvider.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityTemplateAvailabilityProvider.java @@ -20,13 +20,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.springframework.boot.autoconfigure.template.AbstractTemplateAvailabilityProvider; import org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider; -import org.springframework.boot.bind.PropertySourcesPropertyValues; -import org.springframework.boot.bind.RelaxedDataBinder; -import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.Environment; -import org.springframework.core.io.ResourceLoader; -import org.springframework.util.ClassUtils; /** * {@link TemplateAvailabilityProvider} that provides availability information for @@ -39,36 +34,27 @@ import org.springframework.util.ClassUtils; */ @Deprecated public class VelocityTemplateAvailabilityProvider - implements TemplateAvailabilityProvider { + extends AbstractTemplateAvailabilityProvider { - @Override - public boolean isTemplateAvailable(String view, Environment environment, - ClassLoader classLoader, ResourceLoader resourceLoader) { - if (ClassUtils.isPresent("org.apache.velocity.app.VelocityEngine", classLoader)) { - VelocityTemplateAvailabilityProperties properties = new VelocityTemplateAvailabilityProperties(); - RelaxedDataBinder binder = new RelaxedDataBinder(properties, - "spring.velocity"); - binder.bind(new PropertySourcesPropertyValues( - ((ConfigurableEnvironment) environment).getPropertySources())); - for (String path : properties.getResourceLoaderPath()) { - if (resourceLoader.getResource( - path + properties.getPrefix() + view + properties.getSuffix()) - .exists()) { - return true; - } - } - } - return false; + public VelocityTemplateAvailabilityProvider() { + super("org.apache.velocity.app.VelocityEngine", + VelocityTemplateAvailabilityProperties.class, "spring.velocity"); } - static class VelocityTemplateAvailabilityProperties { + static class VelocityTemplateAvailabilityProperties + extends TemplateAvailabilityProperties { private List resourceLoaderPath = new ArrayList( Arrays.asList(VelocityProperties.DEFAULT_RESOURCE_LOADER_PATH)); - private String prefix = VelocityProperties.DEFAULT_PREFIX; + VelocityTemplateAvailabilityProperties() { + super(VelocityProperties.DEFAULT_PREFIX, VelocityProperties.DEFAULT_SUFFIX); + } - private String suffix = VelocityProperties.DEFAULT_SUFFIX; + @Override + protected List getLoaderPath() { + return this.resourceLoaderPath; + } public List getResourceLoaderPath() { return this.resourceLoaderPath; @@ -78,22 +64,6 @@ public class VelocityTemplateAvailabilityProvider this.resourceLoaderPath = resourceLoaderPath; } - public String getPrefix() { - return this.prefix; - } - - public void setPrefix(String prefix) { - this.prefix = prefix; - } - - public String getSuffix() { - return this.suffix; - } - - public void setSuffix(String suffix) { - this.suffix = suffix; - } - } } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java index 5325e348e5b..57da539dbc9 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java @@ -450,14 +450,15 @@ public class ServerPropertiesTests { Map map = new HashMap(); map.put("server.max-http-post-size", "-1"); bindProperties(map); - TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory(0); + TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory( + 0); this.properties.customize(container); - TomcatEmbeddedServletContainer embeddedContainer = - (TomcatEmbeddedServletContainer) container.getEmbeddedServletContainer(); + TomcatEmbeddedServletContainer embeddedContainer = (TomcatEmbeddedServletContainer) container + .getEmbeddedServletContainer(); embeddedContainer.start(); try { assertThat(embeddedContainer.getTomcat().getConnector().getMaxPostSize()) - .isEqualTo(-1); + .isEqualTo(-1); } finally { embeddedContainer.stop(); diff --git a/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc b/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc index ce307627836..d7b47f5282a 100644 --- a/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc @@ -698,52 +698,52 @@ Sample summarized HTTP response (default for anonymous request): [source,indent=0] ---- -$ curl -i localhost:8080/health -HTTP/1.1 200 -X-Application-Context: application -Content-Type: application/vnd.spring-boot.actuator.v1+json;charset=UTF-8 -Content-Length: 15 + $ curl -i localhost:8080/health + HTTP/1.1 200 + X-Application-Context: application + Content-Type: application/vnd.spring-boot.actuator.v1+json;charset=UTF-8 + Content-Length: 15 -{"status":"UP"} + {"status":"UP"} ---- Sample summarized HTTP response for status "DOWN" (notice the 503 status code): [source,indent=0] ---- -$ curl -i localhost:8080/health -HTTP/1.1 503 -X-Application-Context: application -Content-Type: application/vnd.spring-boot.actuator.v1+json;charset=UTF-8 -Content-Length: 17 + $ curl -i localhost:8080/health + HTTP/1.1 503 + X-Application-Context: application + Content-Type: application/vnd.spring-boot.actuator.v1+json;charset=UTF-8 + Content-Length: 17 -{"status":"DOWN"} + {"status":"DOWN"} ---- Sample detailed HTTP response: [source,indent=0] ---- -$ curl -i localhost:8080/health -HTTP/1.1 200 OK -X-Application-Context: application -Content-Type: application/vnd.spring-boot.actuator.v1+json;charset=UTF-8 -Content-Length: 221 + $ curl -i localhost:8080/health + HTTP/1.1 200 OK + X-Application-Context: application + Content-Type: application/vnd.spring-boot.actuator.v1+json;charset=UTF-8 + Content-Length: 221 -{ - "status" : "UP", - "diskSpace" : { - "status" : "UP", - "total" : 63251804160, - "free" : 31316164608, - "threshold" : 10485760 - }, - "db" : { - "status" : "UP", - "database" : "H2", - "hello" : 1 - } -} + { + "status" : "UP", + "diskSpace" : { + "status" : "UP", + "total" : 63251804160, + "free" : 31316164608, + "threshold" : 10485760 + }, + "db" : { + "status" : "UP", + "database" : "H2", + "hello" : 1 + } + } ---- The above-described restrictions can be enhanced, thereby allowing only authenticated diff --git a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java index 22ba59fe5e2..2b27eb869dc 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-actuator/src/test/java/sample/actuator/SampleActuatorApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -198,7 +198,7 @@ public class SampleActuatorApplicationTests { List> list = entity.getBody(); Map trace = list.get(0); @SuppressWarnings("unchecked") - Map map = (Map) ((Map)trace + Map map = (Map) ((Map) trace .get("info")).get("parameters"); assertThat(map.get("param1")).isNotNull(); }