diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilterTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilterTests.java index 97540d8e7b9..0ef7533951a 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilterTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/server/MetricsWebFilterTests.java @@ -54,8 +54,10 @@ public class MetricsWebFilterTests { public void filterAddsTagsToRegistry() { MockServerWebExchange exchange = createExchange("/projects/spring-boot", "/projects/{project}"); - this.webFilter.filter(exchange, - serverWebExchange -> exchange.getResponse().setComplete()).block(); + this.webFilter + .filter(exchange, + (serverWebExchange) -> exchange.getResponse().setComplete()) + .block(); assertMetricsContainsTag("uri", "/projects/{project}"); assertMetricsContainsTag("status", "200"); } @@ -64,9 +66,11 @@ public class MetricsWebFilterTests { public void filterAddsTagsToRegistryForExceptions() { MockServerWebExchange exchange = createExchange("/projects/spring-boot", "/projects/{project}"); - this.webFilter.filter(exchange, - serverWebExchange -> Mono.error(new IllegalStateException("test error"))) - .onErrorResume(t -> { + this.webFilter + .filter(exchange, + (serverWebExchange) -> Mono + .error(new IllegalStateException("test error"))) + .onErrorResume((t) -> { exchange.getResponse().setStatusCodeValue(500); return exchange.getResponse().setComplete(); }).block(); @@ -78,14 +82,11 @@ public class MetricsWebFilterTests { public void filterAddsTagsToRegistryForExceptionsAndCommittedResponse() { MockServerWebExchange exchange = createExchange("/projects/spring-boot", "/projects/{project}"); - this.webFilter.filter(exchange, - serverWebExchange -> { - exchange.getResponse().setStatusCodeValue(500); - return exchange.getResponse().setComplete() - .then(Mono.error(new IllegalStateException("test error"))); - }) - .onErrorResume(t -> Mono.empty()) - .block(); + this.webFilter.filter(exchange, (serverWebExchange) -> { + exchange.getResponse().setStatusCodeValue(500); + return exchange.getResponse().setComplete() + .then(Mono.error(new IllegalStateException("test error"))); + }).onErrorResume((t) -> Mono.empty()).block(); assertMetricsContainsTag("uri", "/projects/{project}"); assertMetricsContainsTag("status", "500"); } @@ -94,15 +95,14 @@ public class MetricsWebFilterTests { PathPatternParser parser = new PathPatternParser(); MockServerWebExchange exchange = MockServerWebExchange .from(MockServerHttpRequest.get(path).build()); - exchange.getAttributes() - .put(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE, parser.parse(pathPattern)); + exchange.getAttributes().put(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE, + parser.parse(pathPattern)); return exchange; } private void assertMetricsContainsTag(String tagKey, String tagValue) { - assertThat(this.registry.get(REQUEST_METRICS_NAME) - .tag(tagKey, tagValue).timer().count()) - .isEqualTo(1); + assertThat(this.registry.get(REQUEST_METRICS_NAME).tag(tagKey, tagValue).timer() + .count()).isEqualTo(1); } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationTests.java index 419bd6da664..ebef2df6069 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/session/SessionAutoConfigurationTests.java @@ -101,22 +101,25 @@ public class SessionAutoConfigurationTests extends AbstractSessionAutoConfigurat @Test public void autoConfigWhenSpringSessionTimeoutIsSetShouldUseThat() { - this.contextRunner.withUserConfiguration(ServerPropertiesConfiguration.class, - SessionRepositoryConfiguration.class) + this.contextRunner + .withUserConfiguration(ServerPropertiesConfiguration.class, + SessionRepositoryConfiguration.class) .withPropertyValues("server.servlet.session.timeout=1", - "spring.session.timeout=3").run((context) -> - assertThat(context.getBean(SessionProperties.class).getTimeout()) - .isEqualTo(Duration.ofSeconds(3))); + "spring.session.timeout=3") + .run((context) -> assertThat( + context.getBean(SessionProperties.class).getTimeout()) + .isEqualTo(Duration.ofSeconds(3))); } @Test public void autoConfigWhenSpringSessionTimeoutIsNotSetShouldUseServerSessionTimeout() { - this.contextRunner.withUserConfiguration(ServerPropertiesConfiguration.class, - SessionRepositoryConfiguration.class) - .withPropertyValues("server.servlet.session.timeout=3").run((context) -> { - assertThat(context.getBean(SessionProperties.class).getTimeout()) - .isEqualTo(Duration.ofSeconds(3)); - }); + this.contextRunner + .withUserConfiguration(ServerPropertiesConfiguration.class, + SessionRepositoryConfiguration.class) + .withPropertyValues("server.servlet.session.timeout=3") + .run((context) -> assertThat( + context.getBean(SessionProperties.class).getTimeout()) + .isEqualTo(Duration.ofSeconds(3))); } @SuppressWarnings("unchecked") diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java index c198ef87ee7..f21bde4444c 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/DependencyFilterMojoTests.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. @@ -136,6 +136,7 @@ public class DependencyFilterMojoTests { private final ArtifactsFilter[] additionalFilters; + @SuppressWarnings("deprecation") private TestableDependencyFilterMojo(List excludes, String excludeGroupIds, String excludeArtifactIds, ArtifactsFilter... additionalFilters) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java index 50f8208d04a..47155fca8c7 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java @@ -342,15 +342,16 @@ public class ConfigFileApplicationListener * properties that are already set. */ private void initializeProfiles() { - //The default profile for these purposes is represented as null. We add it + // The default profile for these purposes is represented as null. We add it // first so that it is processed first and has lowest priority. this.profiles.add(null); Set activatedViaProperty = getProfilesActivatedViaActiveProfileProperty(); processOtherActiveProfiles(activatedViaProperty); - // Any pre-existing active activeProfiles set via property sources (e.g. System + // Any pre-existing active activeProfiles set via property sources (e.g. + // System // properties) take precedence over those added in config files. addActiveProfiles(activatedViaProperty); - if (this.profiles.size() == 1) { //only has null profile + if (this.profiles.size() == 1) { // only has null profile for (String defaultProfileName : this.environment.getDefaultProfiles()) { ConfigFileApplicationListener.Profile defaultProfile = new ConfigFileApplicationListener.Profile( defaultProfileName, true); @@ -372,9 +373,10 @@ public class ConfigFileApplicationListener } private void processOtherActiveProfiles(Set activatedViaProperty) { - List otherActiveProfiles = Arrays.stream(this.environment.getActiveProfiles()) - .map(Profile::new) - .filter(o -> !activatedViaProperty.contains(o)).collect(Collectors.toList()); + List otherActiveProfiles = Arrays + .stream(this.environment.getActiveProfiles()).map(Profile::new) + .filter((o) -> !activatedViaProperty.contains(o)) + .collect(Collectors.toList()); this.profiles.addAll(otherActiveProfiles); } @@ -397,7 +399,8 @@ public class ConfigFileApplicationListener } private void removeUnprocessedDefaultProfiles() { - this.profiles.removeIf(profile -> (profile != null && profile.isDefaultProfile())); + this.profiles.removeIf( + (profile) -> (profile != null && profile.isDefaultProfile())); } private DocumentFilter getPositiveProfileFilter(Profile profile) { diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatWebServer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatWebServer.java index 907039424b1..bd14a7646ae 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatWebServer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatWebServer.java @@ -198,7 +198,7 @@ public class TomcatWebServer implements WebServer { addPreviouslyRemovedConnectors(); Connector connector = this.tomcat.getConnector(); if (connector != null && this.autoStart) { - startConnector(); + performDeferredLoadOnStartup(); } checkThatConnectorsHaveStarted(); this.started = true; @@ -272,7 +272,7 @@ public class TomcatWebServer implements WebServer { } } - private void startConnector() { + private void performDeferredLoadOnStartup() { try { for (Container child : this.tomcat.getHost().findChildren()) { if (child instanceof TomcatEmbeddedContext) { @@ -349,4 +349,5 @@ public class TomcatWebServer implements WebServer { public Tomcat getTomcat() { return this.tomcat; } + }