From 75639aa682a9ac4cf8b6f54987f3629f2af3e928 Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Thu, 17 May 2018 19:21:40 +0900 Subject: [PATCH] Polish Closes gh-13192 --- .../boot/actuate/health/AbstractHealthAggregator.java | 6 +++--- spring-boot-project/spring-boot-cli/pom.xml | 6 +++--- .../spring-boot-docs/src/main/asciidoc/howto.adoc | 2 +- .../runner/classpath/ModifiedClassPathRunner.java | 2 +- .../boot/web/servlet/ServletContextInitializerBeans.java | 9 ++++----- .../source/MockConfigurationPropertySource.java | 6 ------ 6 files changed, 12 insertions(+), 19 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthAggregator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthAggregator.java index a4f67bd5733..98140ce83d5 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthAggregator.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/AbstractHealthAggregator.java @@ -16,10 +16,10 @@ package org.springframework.boot.actuate.health; -import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * Base {@link HealthAggregator} implementation to allow subclasses to focus on @@ -33,8 +33,8 @@ public abstract class AbstractHealthAggregator implements HealthAggregator { @Override public final Health aggregate(Map healths) { - List statusCandidates = new ArrayList<>(); - healths.values().forEach((health) -> statusCandidates.add(health.getStatus())); + List statusCandidates = healths.values().stream() + .map(Health::getStatus).collect(Collectors.toList()); Status status = aggregateStatus(statusCandidates); Map details = aggregateDetails(healths); return new Health.Builder(status, details).build(); diff --git a/spring-boot-project/spring-boot-cli/pom.xml b/spring-boot-project/spring-boot-cli/pom.xml index 902b717cf34..7fc84062f61 100644 --- a/spring-boot-project/spring-boot-cli/pom.xml +++ b/spring-boot-project/spring-boot-cli/pom.xml @@ -333,9 +333,9 @@ - - + + diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/howto.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/howto.adoc index 08aaec67604..d040c6959c4 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/howto.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/howto.adoc @@ -1365,7 +1365,7 @@ use `setStatus(int)` rather `sendError(int)`. This prevents Jersey from committi response before Spring Security has had an opportunity to report an authentication or authorization failure to the client. -The `jersey.config.server.response.setStatusOverSendError` proeprty must be set to `true` +The `jersey.config.server.response.setStatusOverSendError` property must be set to `true` on the application's `ResourceConfig` bean, as shown in the following example: [source,java,indent=0] diff --git a/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/runner/classpath/ModifiedClassPathRunner.java b/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/runner/classpath/ModifiedClassPathRunner.java index 0519e53e7ae..5cafec5235c 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/runner/classpath/ModifiedClassPathRunner.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/runner/classpath/ModifiedClassPathRunner.java @@ -68,7 +68,7 @@ import org.springframework.util.StringUtils; public class ModifiedClassPathRunner extends BlockJUnit4ClassRunner { private static final Pattern INTELLIJ_CLASSPATH_JAR_PATTERN = Pattern - .compile(".*classpath(\\d+)?.jar"); + .compile(".*classpath(\\d+)?\\.jar"); public ModifiedClassPathRunner(Class testClass) throws InitializationError { super(testClass); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java index acc092b7fb9..bba910fd333 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletContextInitializerBeans.java @@ -28,6 +28,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import java.util.stream.Collectors; import javax.servlet.Filter; import javax.servlet.MultipartConfigElement; @@ -78,11 +79,9 @@ public class ServletContextInitializerBeans this.initializers = new LinkedMultiValueMap<>(); addServletContextInitializerBeans(beanFactory); addAdaptableBeans(beanFactory); - List sortedInitializers = new ArrayList<>(); - this.initializers.values().forEach((contextInitializers) -> { - AnnotationAwareOrderComparator.sort(contextInitializers); - sortedInitializers.addAll(contextInitializers); - }); + List sortedInitializers = this.initializers.values().stream() + .flatMap(value -> value.stream().sorted(AnnotationAwareOrderComparator.INSTANCE)) + .collect(Collectors.toList()); this.sortedList = Collections.unmodifiableList(sortedInitializers); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/MockConfigurationPropertySource.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/MockConfigurationPropertySource.java index d44119fb8c3..11a4cd31996 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/MockConfigurationPropertySource.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/MockConfigurationPropertySource.java @@ -107,12 +107,6 @@ public class MockConfigurationPropertySource return MockConfigurationPropertySource.this.getConfigurationProperty(name); } - @Override - public ConfigurationPropertyState containsDescendantOf( - ConfigurationPropertyName name) { - return ConfigurationPropertyState.UNKNOWN; - } - } }