Use Stream.toList instead of Stream.collect when possible
Update code to make use of `Stream.toList()` whenever possible. Closes gh-28177
This commit is contained in:
parent
118836d204
commit
e0b67889a8
|
@ -29,7 +29,6 @@ import java.util.List;
|
|||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.Task;
|
||||
|
@ -124,8 +123,7 @@ public class AutoConfigurationMetadata extends DefaultTask {
|
|||
return Collections.emptyList();
|
||||
}
|
||||
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
|
||||
return reader.lines().map(this::stripComment).filter((line) -> !line.isEmpty())
|
||||
.collect(Collectors.toList());
|
||||
return reader.lines().map(this::stripComment).filter((line) -> !line.isEmpty()).toList();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ import java.util.HashMap;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
@ -301,7 +300,7 @@ public class BomExtension {
|
|||
public void setModules(List<Object> modules) {
|
||||
this.modules = modules.stream()
|
||||
.map((input) -> (input instanceof Module module) ? module : new Module((String) input))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
public void setImports(List<String> imports) {
|
||||
|
|
|
@ -269,9 +269,7 @@ public class BomPlugin implements Plugin<Project> {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<Node> findChildren(Node parent, String name) {
|
||||
return (List<Node>) parent.children().stream().filter((child) -> isNodeWithName(child, name))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return parent.children().stream().filter((child) -> isNodeWithName(child, name)).toList();
|
||||
}
|
||||
|
||||
private boolean isNodeWithName(Object candidate, String name) {
|
||||
|
|
|
@ -27,7 +27,7 @@ import java.util.Map;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||
import org.gradle.api.InvalidUserDataException;
|
||||
|
@ -71,8 +71,7 @@ public final class InteractiveUpgradeResolver implements UpgradeResolver {
|
|||
librariesByName.put(library.getName(), library);
|
||||
}
|
||||
return librariesToUpgrade.stream().filter((library) -> !library.getName().equals("Spring Boot"))
|
||||
.map((library) -> resolveUpgrade(library, librariesByName)).filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
.map((library) -> resolveUpgrade(library, librariesByName)).filter(Objects::nonNull).toList();
|
||||
}
|
||||
|
||||
private Upgrade resolveUpgrade(Library library, Map<String, Library> libraries) {
|
||||
|
@ -112,13 +111,13 @@ public final class InteractiveUpgradeResolver implements UpgradeResolver {
|
|||
}
|
||||
List<DependencyVersion> allVersions = moduleVersions.values().stream().flatMap(SortedSet::stream).distinct()
|
||||
.filter((dependencyVersion) -> isPermitted(dependencyVersion, library.getProhibitedVersions()))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
if (allVersions.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return allVersions.stream()
|
||||
.map((version) -> new ResolvedVersionOption(version, getMissingModules(moduleVersions, version)))
|
||||
.collect(Collectors.toList());
|
||||
Stream<VersionOption> resolvedVersionOptions = allVersions.stream()
|
||||
.map((version) -> new ResolvedVersionOption(version, getMissingModules(moduleVersions, version)));
|
||||
return resolvedVersionOptions.toList();
|
||||
}
|
||||
|
||||
private List<VersionOption> determineAlignedVersionOption(Library library, Map<String, Library> libraries) {
|
||||
|
|
|
@ -30,7 +30,6 @@ import java.util.Properties;
|
|||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
@ -163,7 +162,7 @@ public class UpgradeBom extends DefaultTask {
|
|||
}
|
||||
Predicate<String> libraryPredicate = Pattern.compile(pattern).asPredicate();
|
||||
List<Library> matchingLibraries = this.bom.getLibraries().stream()
|
||||
.filter((library) -> libraryPredicate.test(library.getName())).collect(Collectors.toList());
|
||||
.filter((library) -> libraryPredicate.test(library.getName())).toList();
|
||||
if (matchingLibraries.isEmpty()) {
|
||||
throw new InvalidUserDataException("No libraries matched '" + pattern + "'");
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.client.HttpClientErrorException.Forbidden;
|
||||
|
@ -92,8 +91,7 @@ final class StandardGitHubRepository implements GitHubRepository {
|
|||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
private <T> List<T> get(String name, Function<Map<String, Object>, T> mapper) {
|
||||
ResponseEntity<List> response = this.rest.getForEntity(name, List.class);
|
||||
List<Map<String, Object>> body = response.getBody();
|
||||
return body.stream().map(mapper).collect(Collectors.toList());
|
||||
return ((List<Map<String, Object>>) response.getBody()).stream().map(mapper).toList();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -106,8 +106,7 @@ public class CheckClasspathForUnnecessaryExclusions extends DefaultTask {
|
|||
if (!exclusions.isEmpty()) {
|
||||
Dependency toCheck = this.dependencyById.get(dependencyId);
|
||||
List<String> dependencies = this.configurations.detachedConfiguration(toCheck, this.platform)
|
||||
.getIncoming().getArtifacts().getArtifacts().stream().map(this::getId)
|
||||
.collect(Collectors.toList());
|
||||
.getIncoming().getArtifacts().getArtifacts().stream().map(this::getId).toList();
|
||||
exclusions.removeAll(dependencies);
|
||||
removeProfileExclusions(dependencyId, exclusions);
|
||||
if (!exclusions.isEmpty()) {
|
||||
|
|
|
@ -27,7 +27,6 @@ import java.util.Collections;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
|
@ -95,7 +94,7 @@ public class CheckAdditionalSpringConfigurationMetadata extends SourceTask {
|
|||
@SuppressWarnings("unchecked")
|
||||
private void check(String key, Map<String, Object> json, Analysis analysis) {
|
||||
List<Map<String, Object>> groups = (List<Map<String, Object>>) json.get(key);
|
||||
List<String> names = groups.stream().map((group) -> (String) group.get("name")).collect(Collectors.toList());
|
||||
List<String> names = groups.stream().map((group) -> (String) group.get("name")).toList();
|
||||
List<String> sortedNames = sortedCopy(names);
|
||||
for (int i = 0; i < names.size(); i++) {
|
||||
String actual = names.get(i);
|
||||
|
|
|
@ -25,7 +25,6 @@ import java.util.ArrayList;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
|
@ -154,8 +153,7 @@ public class CheckSpringConfigurationMetadata extends DefaultTask {
|
|||
else {
|
||||
lines.add("The following properties have no description:");
|
||||
lines.add("");
|
||||
lines.addAll(this.propertiesWithNoDescription.stream().map((line) -> "\t" + line)
|
||||
.collect(Collectors.toList()));
|
||||
lines.addAll(this.propertiesWithNoDescription.stream().map((line) -> "\t" + line).toList());
|
||||
}
|
||||
lines.add("");
|
||||
return lines.iterator();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -21,7 +21,6 @@ import java.io.FileWriter;
|
|||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.Task;
|
||||
|
@ -98,10 +97,8 @@ public class DocumentPluginGoals extends DefaultTask {
|
|||
writer.printf("`%s:%s:%s`%n", plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion());
|
||||
writer.println();
|
||||
writer.println(mojo.getDescription());
|
||||
List<Parameter> parameters = mojo.getParameters().stream().filter(Parameter::isEditable)
|
||||
.collect(Collectors.toList());
|
||||
List<Parameter> requiredParameters = parameters.stream().filter(Parameter::isRequired)
|
||||
.collect(Collectors.toList());
|
||||
List<Parameter> parameters = mojo.getParameters().stream().filter(Parameter::isEditable).toList();
|
||||
List<Parameter> requiredParameters = parameters.stream().filter(Parameter::isRequired).toList();
|
||||
String parametersSectionId = sectionId + "-parameters";
|
||||
String detailsSectionId = parametersSectionId + "-details";
|
||||
if (!requiredParameters.isEmpty()) {
|
||||
|
@ -112,7 +109,7 @@ public class DocumentPluginGoals extends DefaultTask {
|
|||
writeParametersTable(writer, detailsSectionId, requiredParameters);
|
||||
}
|
||||
List<Parameter> optionalParameters = parameters.stream().filter((parameter) -> !parameter.isRequired())
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
if (!optionalParameters.isEmpty()) {
|
||||
writer.println();
|
||||
writer.println();
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.springframework.boot.build.testing;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.gradle.api.services.BuildService;
|
||||
import org.gradle.api.services.BuildServiceParameters;
|
||||
|
@ -42,8 +41,7 @@ public abstract class TestResultsOverview
|
|||
private final Object monitor = new Object();
|
||||
|
||||
void addFailures(Test test, List<TestDescriptor> failureDescriptors) {
|
||||
List<TestFailure> testFailures = failureDescriptors.stream().map(TestFailure::new).sorted()
|
||||
.collect(Collectors.toList());
|
||||
List<TestFailure> testFailures = failureDescriptors.stream().map(TestFailure::new).sorted().toList();
|
||||
synchronized (this.monitor) {
|
||||
this.testFailures.put(test, testFailures);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -18,7 +18,6 @@ package org.springframework.boot.build.mavenplugin;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
@ -44,8 +43,8 @@ class PluginXmlParserTests {
|
|||
assertThat(plugin.getArtifactId()).isEqualTo("spring-boot-maven-plugin");
|
||||
assertThat(plugin.getVersion()).isEqualTo("2.2.0.GRADLE-SNAPSHOT");
|
||||
assertThat(plugin.getGoalPrefix()).isEqualTo("spring-boot");
|
||||
assertThat(plugin.getMojos().stream().map(PluginXmlParser.Mojo::getGoal).collect(Collectors.toList()))
|
||||
.containsExactly("build-info", "help", "repackage", "run", "start", "stop");
|
||||
assertThat(plugin.getMojos().stream().map(PluginXmlParser.Mojo::getGoal)).containsExactly("build-info", "help",
|
||||
"repackage", "run", "start", "stop");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.io.PrintWriter;
|
|||
import java.io.StringReader;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.gradle.testkit.runner.BuildResult;
|
||||
import org.gradle.testkit.runner.GradleRunner;
|
||||
|
@ -170,7 +169,7 @@ class TestFailuresPluginIntegrationTests {
|
|||
|
||||
private List<String> readLines(String output) {
|
||||
try (BufferedReader reader = new BufferedReader(new StringReader(output))) {
|
||||
return reader.lines().collect(Collectors.toList());
|
||||
return reader.lines().toList();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.util.Arrays;
|
|||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
|
@ -99,7 +98,7 @@ public class ReactiveCloudFoundryActuatorAutoConfiguration {
|
|||
List<InfoContributor> contributors = infoContributors.orderedStream()
|
||||
.map((infoContributor) -> (infoContributor instanceof GitInfoContributor)
|
||||
? new GitInfoContributor(properties, InfoPropertiesInfoContributor.Mode.FULL) : infoContributor)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
return new CloudFoundryInfoEndpointWebExtension(new InfoEndpoint(contributors));
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.util.Arrays;
|
|||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.actuate.autoconfigure.cloudfoundry.CloudFoundryWebEndpointDiscoverer;
|
||||
|
@ -103,7 +102,7 @@ public class CloudFoundryActuatorAutoConfiguration {
|
|||
List<InfoContributor> contributors = infoContributors.orderedStream()
|
||||
.map((infoContributor) -> (infoContributor instanceof GitInfoContributor)
|
||||
? new GitInfoContributor(properties, InfoPropertiesInfoContributor.Mode.FULL) : infoContributor)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
return new CloudFoundryInfoEndpointWebExtension(new InfoEndpoint(contributors));
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package org.springframework.boot.actuate.autoconfigure.endpoint;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
|
||||
|
@ -52,9 +51,8 @@ public class EndpointAutoConfiguration {
|
|||
public ParameterValueMapper endpointOperationParameterMapper(
|
||||
@EndpointConverter ObjectProvider<Converter<?, ?>> converters,
|
||||
@EndpointConverter ObjectProvider<GenericConverter> genericConverters) {
|
||||
ConversionService conversionService = createConversionService(
|
||||
converters.orderedStream().collect(Collectors.toList()),
|
||||
genericConverters.orderedStream().collect(Collectors.toList()));
|
||||
ConversionService conversionService = createConversionService(converters.orderedStream().toList(),
|
||||
genericConverters.orderedStream().toList());
|
||||
return new ConversionServiceParameterValueMapper(conversionService);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.springframework.boot.actuate.autoconfigure.endpoint.jmx;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.management.MBeanServer;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
@ -84,8 +82,7 @@ public class JmxEndpointAutoConfiguration {
|
|||
ObjectProvider<OperationInvokerAdvisor> invokerAdvisors,
|
||||
ObjectProvider<EndpointFilter<ExposableJmxEndpoint>> filters) {
|
||||
return new JmxEndpointDiscoverer(this.applicationContext, parameterValueMapper,
|
||||
invokerAdvisors.orderedStream().collect(Collectors.toList()),
|
||||
filters.orderedStream().collect(Collectors.toList()));
|
||||
invokerAdvisors.orderedStream().toList(), filters.orderedStream().toList());
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -18,7 +18,6 @@ package org.springframework.boot.actuate.autoconfigure.endpoint.web;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration;
|
||||
|
@ -91,17 +90,15 @@ public class WebEndpointAutoConfiguration {
|
|||
ObjectProvider<OperationInvokerAdvisor> invokerAdvisors,
|
||||
ObjectProvider<EndpointFilter<ExposableWebEndpoint>> filters) {
|
||||
return new WebEndpointDiscoverer(this.applicationContext, parameterValueMapper, endpointMediaTypes,
|
||||
endpointPathMappers.orderedStream().collect(Collectors.toList()),
|
||||
invokerAdvisors.orderedStream().collect(Collectors.toList()),
|
||||
filters.orderedStream().collect(Collectors.toList()));
|
||||
endpointPathMappers.orderedStream().toList(), invokerAdvisors.orderedStream().toList(),
|
||||
filters.orderedStream().toList());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(ControllerEndpointsSupplier.class)
|
||||
public ControllerEndpointDiscoverer controllerEndpointDiscoverer(ObjectProvider<PathMapper> endpointPathMappers,
|
||||
ObjectProvider<Collection<EndpointFilter<ExposableControllerEndpoint>>> filters) {
|
||||
return new ControllerEndpointDiscoverer(this.applicationContext,
|
||||
endpointPathMappers.orderedStream().collect(Collectors.toList()),
|
||||
return new ControllerEndpointDiscoverer(this.applicationContext, endpointPathMappers.orderedStream().toList(),
|
||||
filters.getIfAvailable(Collections::emptyList));
|
||||
}
|
||||
|
||||
|
@ -134,9 +131,8 @@ public class WebEndpointAutoConfiguration {
|
|||
ServletEndpointDiscoverer servletEndpointDiscoverer(ApplicationContext applicationContext,
|
||||
ObjectProvider<PathMapper> endpointPathMappers,
|
||||
ObjectProvider<EndpointFilter<ExposableServletEndpoint>> filters) {
|
||||
return new ServletEndpointDiscoverer(applicationContext,
|
||||
endpointPathMappers.orderedStream().collect(Collectors.toList()),
|
||||
filters.orderedStream().collect(Collectors.toList()));
|
||||
return new ServletEndpointDiscoverer(applicationContext, endpointPathMappers.orderedStream().toList(),
|
||||
filters.orderedStream().toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.Collections;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.glassfish.jersey.server.ResourceConfig;
|
||||
import org.glassfish.jersey.server.model.Resource;
|
||||
|
@ -183,7 +182,7 @@ class JerseyWebEndpointManagementContextConfiguration {
|
|||
WebServerNamespace.MANAGEMENT, this.groups);
|
||||
Collection<Resource> endpointResources = resourceFactory
|
||||
.createEndpointResources(mapping, Collections.singletonList(this.endpoint), null, null, false)
|
||||
.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
||||
.stream().filter(Objects::nonNull).toList();
|
||||
register(endpointResources, config);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.util.Collection;
|
|||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.glassfish.jersey.server.ResourceConfig;
|
||||
import org.glassfish.jersey.server.model.Resource;
|
||||
|
@ -162,7 +161,7 @@ class HealthEndpointWebExtensionConfiguration {
|
|||
WebServerNamespace.SERVER, this.groups);
|
||||
Collection<Resource> endpointResources = resourceFactory
|
||||
.createEndpointResources(mapping, Collections.singletonList(this.endpoint), null, null, false)
|
||||
.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
||||
.stream().filter(Objects::nonNull).toList();
|
||||
register(endpointResources, config);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.springframework.boot.actuate.autoconfigure.info;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint;
|
||||
import org.springframework.boot.actuate.info.InfoContributor;
|
||||
|
@ -40,7 +38,7 @@ public class InfoEndpointAutoConfiguration {
|
|||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public InfoEndpoint infoEndpoint(ObjectProvider<InfoContributor> infoContributors) {
|
||||
return new InfoEndpoint(infoContributors.orderedStream().collect(Collectors.toList()));
|
||||
return new InfoEndpoint(infoContributors.orderedStream().toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class DataSourceHealthContributorAutoConfiguration implements Initializin
|
|||
|
||||
public DataSourceHealthContributorAutoConfiguration(
|
||||
ObjectProvider<DataSourcePoolMetadataProvider> metadataProviders) {
|
||||
this.metadataProviders = metadataProviders.orderedStream().collect(Collectors.toList());
|
||||
this.metadataProviders = metadataProviders.orderedStream().toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -16,9 +16,6 @@
|
|||
|
||||
package org.springframework.boot.actuate.autoconfigure.metrics;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import io.micrometer.core.instrument.Metrics;
|
||||
import io.micrometer.core.instrument.binder.MeterBinder;
|
||||
|
@ -74,7 +71,7 @@ class MeterRegistryConfigurer {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void customize(MeterRegistry registry) {
|
||||
LambdaSafe.callbacks(MeterRegistryCustomizer.class, asOrderedList(this.customizers), registry)
|
||||
LambdaSafe.callbacks(MeterRegistryCustomizer.class, this.customizers.orderedStream().toList(), registry)
|
||||
.withLogger(MeterRegistryConfigurer.class).invoke((customizer) -> customizer.customize(registry));
|
||||
}
|
||||
|
||||
|
@ -86,8 +83,4 @@ class MeterRegistryConfigurer {
|
|||
this.binders.orderedStream().forEach((binder) -> binder.bindTo(registry));
|
||||
}
|
||||
|
||||
private <T> List<T> asOrderedList(ObjectProvider<T> provider) {
|
||||
return provider.orderedStream().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -18,9 +18,9 @@ package org.springframework.boot.actuate.autoconfigure.metrics;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.micrometer.core.instrument.Meter;
|
||||
import io.micrometer.core.instrument.Meter.Id;
|
||||
|
@ -61,11 +61,14 @@ public class PropertiesMeterFilter implements MeterFilter {
|
|||
return new MeterFilter() {
|
||||
};
|
||||
}
|
||||
Tags commonTags = Tags.of(tags.entrySet().stream().map((entry) -> Tag.of(entry.getKey(), entry.getValue()))
|
||||
.collect(Collectors.toList()));
|
||||
Tags commonTags = Tags.of(tags.entrySet().stream().map(PropertiesMeterFilter::asTag).toList());
|
||||
return MeterFilter.commonTags(commonTags);
|
||||
}
|
||||
|
||||
private static Tag asTag(Entry<String, String> entry) {
|
||||
return Tag.of(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public MeterFilterReply accept(Meter.Id id) {
|
||||
boolean enabled = lookupWithFallbackToAll(this.properties.getEnable(), id, true);
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.springframework.boot.actuate.autoconfigure.metrics.graphql;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import graphql.GraphQL;
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
|
||||
|
@ -56,7 +54,7 @@ public class GraphQlMetricsAutoConfiguration {
|
|||
@Bean
|
||||
@ConditionalOnMissingBean(GraphQlTagsProvider.class)
|
||||
public DefaultGraphQlTagsProvider graphQlTagsProvider(ObjectProvider<GraphQlTagsContributor> contributors) {
|
||||
return new DefaultGraphQlTagsProvider(contributors.orderedStream().collect(Collectors.toList()));
|
||||
return new DefaultGraphQlTagsProvider(contributors.orderedStream().toList());
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.util.Collection;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
|
@ -87,8 +86,7 @@ public class DataSourcePoolMetricsAutoConfiguration {
|
|||
|
||||
@Override
|
||||
public void bindTo(MeterRegistry registry) {
|
||||
List<DataSourcePoolMetadataProvider> metadataProvidersList = this.metadataProviders.stream()
|
||||
.collect(Collectors.toList());
|
||||
List<DataSourcePoolMetadataProvider> metadataProvidersList = this.metadataProviders.stream().toList();
|
||||
this.dataSources.forEach((name, dataSource) -> bindDataSourceToRegistry(name, dataSource,
|
||||
metadataProvidersList, registry));
|
||||
}
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.springframework.boot.actuate.autoconfigure.metrics.web.reactive;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import io.micrometer.core.instrument.config.MeterFilter;
|
||||
|
||||
|
@ -64,7 +62,7 @@ public class WebFluxMetricsAutoConfiguration {
|
|||
@ConditionalOnMissingBean(WebFluxTagsProvider.class)
|
||||
public DefaultWebFluxTagsProvider webFluxTagsProvider(ObjectProvider<WebFluxTagsContributor> contributors) {
|
||||
return new DefaultWebFluxTagsProvider(this.properties.getWeb().getServer().getRequest().isIgnoreTrailingSlash(),
|
||||
contributors.orderedStream().collect(Collectors.toList()));
|
||||
contributors.orderedStream().toList());
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.springframework.boot.actuate.autoconfigure.metrics.web.servlet;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import io.micrometer.core.instrument.config.MeterFilter;
|
||||
import jakarta.servlet.DispatcherType;
|
||||
|
@ -76,7 +74,7 @@ public class WebMvcMetricsAutoConfiguration {
|
|||
@ConditionalOnMissingBean(WebMvcTagsProvider.class)
|
||||
public DefaultWebMvcTagsProvider webMvcTagsProvider(ObjectProvider<WebMvcTagsContributor> contributors) {
|
||||
return new DefaultWebMvcTagsProvider(this.properties.getWeb().getServer().getRequest().isIgnoreTrailingSlash(),
|
||||
contributors.orderedStream().collect(Collectors.toList()));
|
||||
contributors.orderedStream().toList());
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.springframework.boot.actuate.autoconfigure.scheduling;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint;
|
||||
import org.springframework.boot.actuate.scheduling.ScheduledTasksEndpoint;
|
||||
|
@ -40,7 +38,7 @@ public class ScheduledTasksEndpointAutoConfiguration {
|
|||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public ScheduledTasksEndpoint scheduledTasksEndpoint(ObjectProvider<ScheduledTaskHolder> holders) {
|
||||
return new ScheduledTasksEndpoint(holders.orderedStream().collect(Collectors.toList()));
|
||||
return new ScheduledTasksEndpoint(holders.orderedStream().toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -246,8 +246,11 @@ public final class EndpointRequest {
|
|||
}
|
||||
|
||||
private List<ServerWebExchangeMatcher> getDelegateMatchers(Set<String> paths) {
|
||||
return paths.stream().map((path) -> new PathPatternParserServerWebExchangeMatcher(path + "/**"))
|
||||
.collect(Collectors.toList());
|
||||
return paths.stream().map(this::getDelegateMatcher).collect(Collectors.toCollection(ArrayList::new));
|
||||
}
|
||||
|
||||
private PathPatternParserServerWebExchangeMatcher getDelegateMatcher(String path) {
|
||||
return new PathPatternParserServerWebExchangeMatcher(path + "/**");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -270,7 +270,7 @@ public final class EndpointRequest {
|
|||
private List<RequestMatcher> getDelegateMatchers(RequestMatcherFactory requestMatcherFactory,
|
||||
RequestMatcherProvider matcherProvider, Set<String> paths) {
|
||||
return paths.stream().map((path) -> requestMatcherFactory.antPath(matcherProvider, path, "/**"))
|
||||
.collect(Collectors.toList());
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ package org.springframework.boot.actuate.autoconfigure.tracing;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.micrometer.tracing.SamplerFunction;
|
||||
import io.micrometer.tracing.otel.bridge.DefaultHttpClientAttributesGetter;
|
||||
|
@ -110,8 +109,7 @@ public class OpenTelemetryAutoConfiguration {
|
|||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
ContextPropagators otelContextPropagators(ObjectProvider<TextMapPropagator> textMapPropagators) {
|
||||
return ContextPropagators
|
||||
.create(TextMapPropagator.composite(textMapPropagators.orderedStream().collect(Collectors.toList())));
|
||||
return ContextPropagators.create(TextMapPropagator.composite(textMapPropagators.orderedStream().toList()));
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
@ -122,8 +120,11 @@ public class OpenTelemetryAutoConfiguration {
|
|||
|
||||
@Bean
|
||||
SpanProcessor otelSpanProcessor(ObjectProvider<SpanExporter> spanExporters) {
|
||||
return SpanProcessor.composite(spanExporters.orderedStream()
|
||||
.map((exporter) -> BatchSpanProcessor.builder(exporter).build()).collect(Collectors.toList()));
|
||||
return SpanProcessor.composite(spanExporters.orderedStream().map(this::buildBatchSpanProcessor).toList());
|
||||
}
|
||||
|
||||
private SpanProcessor buildBatchSpanProcessor(SpanExporter exporter) {
|
||||
return BatchSpanProcessor.builder(exporter).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.springframework.boot.actuate.autoconfigure.web.mappings;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint;
|
||||
import org.springframework.boot.actuate.web.mappings.MappingDescriptionProvider;
|
||||
|
@ -51,8 +49,7 @@ public class MappingsEndpointAutoConfiguration {
|
|||
@Bean
|
||||
public MappingsEndpoint mappingsEndpoint(ApplicationContext applicationContext,
|
||||
ObjectProvider<MappingDescriptionProvider> descriptionProviders) {
|
||||
return new MappingsEndpoint(descriptionProviders.orderedStream().collect(Collectors.toList()),
|
||||
applicationContext);
|
||||
return new MappingsEndpoint(descriptionProviders.orderedStream().toList(), applicationContext);
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -16,11 +16,9 @@
|
|||
|
||||
package org.springframework.boot.actuate.autoconfigure.web.server;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactoryUtils;
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
|
@ -77,21 +75,17 @@ public abstract class ManagementWebServerFactoryCustomizer<T extends Configurabl
|
|||
}
|
||||
|
||||
private void customizeSameAsParentContext(T factory) {
|
||||
List<WebServerFactoryCustomizer<?>> customizers = Arrays.stream(this.customizerClasses).map(this::getCustomizer)
|
||||
.filter(Objects::nonNull).collect(Collectors.toList());
|
||||
List<WebServerFactoryCustomizer<?>> customizers = new ArrayList<>();
|
||||
for (Class<? extends WebServerFactoryCustomizer<?>> customizerClass : this.customizerClasses) {
|
||||
try {
|
||||
customizers.add(BeanFactoryUtils.beanOfTypeIncludingAncestors(this.beanFactory, customizerClass));
|
||||
}
|
||||
catch (NoSuchBeanDefinitionException ex) {
|
||||
}
|
||||
}
|
||||
invokeCustomizers(factory, customizers);
|
||||
}
|
||||
|
||||
private WebServerFactoryCustomizer<?> getCustomizer(
|
||||
Class<? extends WebServerFactoryCustomizer<?>> customizerClass) {
|
||||
try {
|
||||
return BeanFactoryUtils.beanOfTypeIncludingAncestors(this.beanFactory, customizerClass);
|
||||
}
|
||||
catch (NoSuchBeanDefinitionException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void invokeCustomizers(T factory, List<WebServerFactoryCustomizer<?>> customizers) {
|
||||
LambdaSafe.callbacks(WebServerFactoryCustomizer.class, customizers, factory)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -21,7 +21,6 @@ import java.util.Arrays;
|
|||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.net.ssl.SSLException;
|
||||
|
||||
|
@ -211,8 +210,7 @@ class ReactiveCloudFoundryActuatorAutoConfigurationTests {
|
|||
.run((context) -> {
|
||||
CloudFoundryWebFluxEndpointHandlerMapping handlerMapping = getHandlerMapping(context);
|
||||
Collection<ExposableWebEndpoint> endpoints = handlerMapping.getEndpoints();
|
||||
List<EndpointId> endpointIds = endpoints.stream().map(ExposableWebEndpoint::getEndpointId)
|
||||
.collect(Collectors.toList());
|
||||
List<EndpointId> endpointIds = endpoints.stream().map(ExposableWebEndpoint::getEndpointId).toList();
|
||||
assertThat(endpointIds).contains(EndpointId.of("test"));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.endpoint.web;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
@ -90,8 +89,7 @@ class WebEndpointAutoConfigurationTests {
|
|||
WebEndpointDiscoverer discoverer = context.getBean(WebEndpointDiscoverer.class);
|
||||
Collection<ExposableWebEndpoint> endpoints = discoverer.getEndpoints();
|
||||
ExposableWebEndpoint[] webEndpoints = endpoints.toArray(new ExposableWebEndpoint[0]);
|
||||
List<String> paths = Arrays.stream(webEndpoints).map(PathMappedEndpoint::getRootPath)
|
||||
.collect(Collectors.toList());
|
||||
List<String> paths = Arrays.stream(webEndpoints).map(PathMappedEndpoint::getRootPath).toList();
|
||||
assertThat(paths).containsOnly("1/testone", "foo", "testtwo");
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -21,7 +21,6 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
@ -60,8 +59,8 @@ import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWit
|
|||
public abstract class AbstractEndpointDocumentationTests {
|
||||
|
||||
protected static String describeEnumValues(Class<? extends Enum<?>> enumType) {
|
||||
return StringUtils.collectionToDelimitedString(Stream.of(enumType.getEnumConstants())
|
||||
.map((constant) -> "`" + constant.name() + "`").collect(Collectors.toList()), ", ");
|
||||
return StringUtils.collectionToDelimitedString(
|
||||
Stream.of(enumType.getEnumConstants()).map((constant) -> "`" + constant.name() + "`").toList(), ", ");
|
||||
}
|
||||
|
||||
protected OperationPreprocessor limit(String... keys) {
|
||||
|
@ -112,8 +111,7 @@ public abstract class AbstractEndpointDocumentationTests {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> List<Object> select(List<Object> candidates, Predicate<T> filter) {
|
||||
return candidates.stream().filter((candidate) -> filter.test((T) candidate)).limit(3)
|
||||
.collect(Collectors.toList());
|
||||
return candidates.stream().filter((candidate) -> filter.test((T) candidate)).limit(3).toList();
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
|
|
|
@ -18,7 +18,6 @@ package org.springframework.boot.actuate.autoconfigure.security.servlet;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
@ -152,7 +151,7 @@ class ManagementWebSecurityAutoConfigurationTests {
|
|||
SecurityFilterChain testRemoteDevToolsSecurityFilterChain = context
|
||||
.getBean("testRemoteDevToolsSecurityFilterChain", SecurityFilterChain.class);
|
||||
List<SecurityFilterChain> orderedSecurityFilterChains = context.getBeanProvider(SecurityFilterChain.class)
|
||||
.orderedStream().collect(Collectors.toList());
|
||||
.orderedStream().toList();
|
||||
assertThat(orderedSecurityFilterChains).containsExactly(testRemoteDevToolsSecurityFilterChain,
|
||||
testSecurityFilterChain);
|
||||
assertThat(context).doesNotHaveBean(ManagementWebSecurityAutoConfiguration.class);
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.web.server;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -83,7 +82,7 @@ class ManagementContextConfigurationImportSelectorTests {
|
|||
private final List<String> factoryNames;
|
||||
|
||||
private TestManagementContextConfigurationsImportSelector(Class<?>... classes) {
|
||||
this.factoryNames = Stream.of(classes).map(Class::getName).collect(Collectors.toList());
|
||||
this.factoryNames = Stream.of(classes).map(Class::getName).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -21,7 +21,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.boot.actuate.endpoint.annotation.DeleteOperation;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
|
||||
|
@ -110,21 +109,19 @@ public class CachesEndpoint {
|
|||
private List<CacheEntry> getCacheEntries(Predicate<String> cacheNamePredicate,
|
||||
Predicate<String> cacheManagerNamePredicate) {
|
||||
return this.cacheManagers.keySet().stream().filter(cacheManagerNamePredicate)
|
||||
.flatMap((cacheManagerName) -> getCacheEntries(cacheManagerName, cacheNamePredicate).stream())
|
||||
.collect(Collectors.toList());
|
||||
.flatMap((cacheManagerName) -> getCacheEntries(cacheManagerName, cacheNamePredicate).stream()).toList();
|
||||
}
|
||||
|
||||
private List<CacheEntry> getCacheEntries(String cacheManagerName, Predicate<String> cacheNamePredicate) {
|
||||
CacheManager cacheManager = this.cacheManagers.get(cacheManagerName);
|
||||
return cacheManager.getCacheNames().stream().filter(cacheNamePredicate).map(cacheManager::getCache)
|
||||
.filter(Objects::nonNull).map((cache) -> new CacheEntry(cache, cacheManagerName))
|
||||
.collect(Collectors.toList());
|
||||
.filter(Objects::nonNull).map((cache) -> new CacheEntry(cache, cacheManagerName)).toList();
|
||||
}
|
||||
|
||||
private CacheEntry extractUniqueCacheEntry(String cache, List<CacheEntry> entries) {
|
||||
if (entries.size() > 1) {
|
||||
throw new NonUniqueCacheException(cache,
|
||||
entries.stream().map(CacheEntry::getCacheManager).distinct().collect(Collectors.toList()));
|
||||
entries.stream().map(CacheEntry::getCacheManager).distinct().toList());
|
||||
}
|
||||
return (!entries.isEmpty() ? entries.get(0) : null);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -19,7 +19,6 @@ package org.springframework.boot.actuate.couchbase;
|
|||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.couchbase.client.core.diagnostics.ClusterState;
|
||||
import com.couchbase.client.core.diagnostics.DiagnosticsResult;
|
||||
|
@ -44,7 +43,7 @@ class CouchbaseHealth {
|
|||
builder = isCouchbaseUp(this.diagnostics) ? builder.up() : builder.down();
|
||||
builder.withDetail("sdk", this.diagnostics.sdk());
|
||||
builder.withDetail("endpoints", this.diagnostics.endpoints().values().stream().flatMap(Collection::stream)
|
||||
.map(this::describe).collect(Collectors.toList()));
|
||||
.map(this::describe).toList());
|
||||
}
|
||||
|
||||
private boolean isCouchbaseUp(DiagnosticsResult diagnostics) {
|
||||
|
|
|
@ -100,7 +100,7 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten
|
|||
|
||||
private DiscoveredOperationsFactory<O> getOperationsFactory(ParameterValueMapper parameterValueMapper,
|
||||
Collection<OperationInvokerAdvisor> invokerAdvisors) {
|
||||
return new DiscoveredOperationsFactory<O>(parameterValueMapper, invokerAdvisors) {
|
||||
return new DiscoveredOperationsFactory<>(parameterValueMapper, invokerAdvisors) {
|
||||
|
||||
@Override
|
||||
protected O createOperation(EndpointId endpointId, DiscoveredOperationMethod operationMethod,
|
||||
|
@ -199,8 +199,7 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten
|
|||
addOperations(indexed, id, extensionBean.getBean(), true);
|
||||
}
|
||||
assertNoDuplicateOperations(endpointBean, indexed);
|
||||
List<O> operations = indexed.values().stream().map(this::getLast).filter(Objects::nonNull)
|
||||
.collect(Collectors.collectingAndThen(Collectors.toList(), Collections::unmodifiableList));
|
||||
List<O> operations = indexed.values().stream().map(this::getLast).filter(Objects::nonNull).toList();
|
||||
return createEndpoint(endpointBean.getBean(), id, endpointBean.isEnabledByDefault(), operations);
|
||||
}
|
||||
|
||||
|
@ -224,7 +223,7 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten
|
|||
|
||||
private void assertNoDuplicateOperations(EndpointBean endpointBean, MultiValueMap<OperationKey, O> indexed) {
|
||||
List<OperationKey> duplicates = indexed.entrySet().stream().filter((entry) -> entry.getValue().size() > 1)
|
||||
.map(Map.Entry::getKey).collect(Collectors.toList());
|
||||
.map(Map.Entry::getKey).toList();
|
||||
if (!duplicates.isEmpty()) {
|
||||
Set<ExtensionBean> extensions = endpointBean.getExtensions();
|
||||
String extensionBeanNames = extensions.stream().map(ExtensionBean::getBeanName)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -18,7 +18,6 @@ package org.springframework.boot.actuate.endpoint.jmx;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.management.InstanceNotFoundException;
|
||||
import javax.management.MBeanRegistrationException;
|
||||
|
@ -87,7 +86,7 @@ public class JmxEndpointExporter implements InitializingBean, DisposableBean, Be
|
|||
}
|
||||
|
||||
private Collection<ObjectName> register() {
|
||||
return this.endpoints.stream().map(this::register).collect(Collectors.toList());
|
||||
return this.endpoints.stream().map(this::register).toList();
|
||||
}
|
||||
|
||||
private ObjectName register(ExposableJmxEndpoint endpoint) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -23,7 +23,6 @@ import java.util.Collections;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.springframework.boot.actuate.endpoint.EndpointId;
|
||||
|
@ -84,7 +83,9 @@ class DiscoveredJmxOperation extends AbstractDiscoveredOperation implements JmxO
|
|||
Method method = operationMethod.getMethod();
|
||||
ManagedOperationParameter[] managed = jmxAttributeSource.getManagedOperationParameters(method);
|
||||
if (managed.length == 0) {
|
||||
return asList(operationMethod.getParameters().stream().map(DiscoveredJmxOperationParameter::new));
|
||||
Stream<JmxOperationParameter> parameters = operationMethod.getParameters().stream()
|
||||
.map(DiscoveredJmxOperationParameter::new);
|
||||
return parameters.toList();
|
||||
}
|
||||
return mergeParameters(operationMethod.getParameters(), managed);
|
||||
}
|
||||
|
@ -98,10 +99,6 @@ class DiscoveredJmxOperation extends AbstractDiscoveredOperation implements JmxO
|
|||
return Collections.unmodifiableList(merged);
|
||||
}
|
||||
|
||||
private <T> List<T> asList(Stream<T> stream) {
|
||||
return stream.collect(Collectors.collectingAndThen(Collectors.toList(), Collections::unmodifiableList));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
|
|
|
@ -20,9 +20,7 @@ import java.util.Collection;
|
|||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.springframework.boot.actuate.endpoint.EndpointId;
|
||||
|
@ -107,7 +105,7 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
|
|||
* @return all root paths
|
||||
*/
|
||||
public Collection<String> getAllRootPaths() {
|
||||
return asList(stream().map(PathMappedEndpoint::getRootPath));
|
||||
return stream().map(PathMappedEndpoint::getRootPath).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -115,7 +113,7 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
|
|||
* @return all root paths
|
||||
*/
|
||||
public Collection<String> getAllPaths() {
|
||||
return asList(stream().map(this::getPath));
|
||||
return stream().map(this::getPath).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -145,8 +143,4 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
|
|||
return (endpoint != null) ? this.basePath + "/" + endpoint.getRootPath() : null;
|
||||
}
|
||||
|
||||
private <T> List<T> asList(Stream<T> stream) {
|
||||
return stream.collect(Collectors.collectingAndThen(Collectors.toList(), Collections::unmodifiableList));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.util.Date;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.flywaydb.core.Flyway;
|
||||
|
@ -117,7 +116,7 @@ public class FlywayEndpoint {
|
|||
private final List<FlywayMigration> migrations;
|
||||
|
||||
private FlywayDescriptor(MigrationInfo[] migrations) {
|
||||
this.migrations = Stream.of(migrations).map(FlywayMigration::new).collect(Collectors.toList());
|
||||
this.migrations = Stream.of(migrations).map(FlywayMigration::new).toList();
|
||||
}
|
||||
|
||||
public FlywayDescriptor(List<FlywayMigration> migrations) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -22,7 +22,6 @@ import java.util.Collections;
|
|||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
@ -81,7 +80,7 @@ public class SimpleStatusAggregator implements StatusAggregator {
|
|||
}
|
||||
|
||||
private static List<String> getUniformCodes(Stream<String> codes) {
|
||||
return codes.map(SimpleStatusAggregator::getUniformCode).collect(Collectors.toList());
|
||||
return codes.map(SimpleStatusAggregator::getUniformCode).toList();
|
||||
}
|
||||
|
||||
private static String getUniformCode(String code) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -21,7 +21,6 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
|
@ -87,8 +86,7 @@ public class LiquibaseEndpoint {
|
|||
database.setDatabaseChangeLogLockTableName(liquibase.getDatabaseChangeLogLockTable());
|
||||
StandardChangeLogHistoryService service = new StandardChangeLogHistoryService();
|
||||
service.setDatabase(database);
|
||||
return new LiquibaseBean(
|
||||
service.getRanChangeSets().stream().map(ChangeSet::new).collect(Collectors.toList()));
|
||||
return new LiquibaseBean(service.getRanChangeSets().stream().map(ChangeSet::new).toList());
|
||||
}
|
||||
finally {
|
||||
if (database != null) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -26,7 +26,6 @@ import java.lang.management.ThreadInfo;
|
|||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
|
@ -73,8 +72,7 @@ class PlainTextThreadDumpFormatter {
|
|||
}
|
||||
|
||||
private List<MonitorInfo> lockedMonitorsForDepth(MonitorInfo[] lockedMonitors, int depth) {
|
||||
return Stream.of(lockedMonitors).filter((lockedMonitor) -> lockedMonitor.getLockedStackDepth() == depth)
|
||||
.collect(Collectors.toList());
|
||||
return Stream.of(lockedMonitors).filter((candidate) -> candidate.getLockedStackDepth() == depth).toList();
|
||||
}
|
||||
|
||||
private void writeStackTraceElement(PrintWriter writer, StackTraceElement element, ThreadInfo info,
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.micrometer.core.instrument.Meter;
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
|
@ -92,10 +91,7 @@ public class MetricsEndpoint {
|
|||
}
|
||||
|
||||
private List<Tag> parseTags(List<String> tags) {
|
||||
if (tags == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return tags.stream().map(this::parseTag).collect(Collectors.toList());
|
||||
return (tags != null) ? tags.stream().map(this::parseTag).toList() : Collections.emptyList();
|
||||
}
|
||||
|
||||
private Tag parseTag(String tag) {
|
||||
|
@ -157,8 +153,7 @@ public class MetricsEndpoint {
|
|||
}
|
||||
|
||||
private <K, V, T> List<T> asList(Map<K, V> map, BiFunction<K, V, T> mapper) {
|
||||
return map.entrySet().stream().map((entry) -> mapper.apply(entry.getKey(), entry.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
return map.entrySet().stream().map((entry) -> mapper.apply(entry.getKey(), entry.getValue())).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,7 +29,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.quartz.CalendarIntervalTrigger;
|
||||
import org.quartz.CronTrigger;
|
||||
|
@ -99,7 +98,7 @@ public class QuartzEndpoint {
|
|||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
for (String groupName : this.scheduler.getJobGroupNames()) {
|
||||
List<String> jobs = this.scheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName)).stream()
|
||||
.map((key) -> key.getName()).collect(Collectors.toList());
|
||||
.map((key) -> key.getName()).toList();
|
||||
result.put(groupName, Collections.singletonMap("jobs", jobs));
|
||||
}
|
||||
return new QuartzGroups(result);
|
||||
|
@ -117,7 +116,7 @@ public class QuartzEndpoint {
|
|||
Map<String, Object> groupDetails = new LinkedHashMap<>();
|
||||
groupDetails.put("paused", pausedTriggerGroups.contains(groupName));
|
||||
groupDetails.put("triggers", this.scheduler.getTriggerKeys(GroupMatcher.triggerGroupEquals(groupName))
|
||||
.stream().map((key) -> key.getName()).collect(Collectors.toList()));
|
||||
.stream().map((key) -> key.getName()).toList());
|
||||
result.put(groupName, groupDetails);
|
||||
}
|
||||
return new QuartzGroups(result);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -20,7 +20,6 @@ import java.time.Instant;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.boot.actuate.endpoint.annotation.DeleteOperation;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
|
||||
|
@ -77,7 +76,7 @@ public class SessionsEndpoint {
|
|||
private final List<SessionDescriptor> sessions;
|
||||
|
||||
public SessionsReport(Map<String, ? extends Session> sessions) {
|
||||
this.sessions = sessions.values().stream().map(SessionDescriptor::new).collect(Collectors.toList());
|
||||
this.sessions = sessions.values().stream().map(SessionDescriptor::new).toList();
|
||||
}
|
||||
|
||||
public List<SessionDescriptor> getSessions() {
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import reactor.core.publisher.Mono;
|
||||
|
@ -79,7 +78,7 @@ public class DispatcherHandlersMappingDescriptionProvider implements MappingDesc
|
|||
}
|
||||
|
||||
private List<DispatcherHandlerMappingDescription> describeMappings(DispatcherHandler dispatcherHandler) {
|
||||
return dispatcherHandler.getHandlerMappings().stream().flatMap(this::describe).collect(Collectors.toList());
|
||||
return dispatcherHandler.getHandlerMappings().stream().flatMap(this::describe).toList();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -111,7 +110,7 @@ public class DispatcherHandlersMappingDescriptionProvider implements MappingDesc
|
|||
@Override
|
||||
public List<DispatcherHandlerMappingDescription> describe(RequestMappingInfoHandlerMapping handlerMapping) {
|
||||
Map<RequestMappingInfo, HandlerMethod> handlerMethods = handlerMapping.getHandlerMethods();
|
||||
return handlerMethods.entrySet().stream().map(this::describe).collect(Collectors.toList());
|
||||
return handlerMethods.entrySet().stream().map(this::describe).toList();
|
||||
}
|
||||
|
||||
private DispatcherHandlerMappingDescription describe(Entry<RequestMappingInfo, HandlerMethod> mapping) {
|
||||
|
@ -134,7 +133,7 @@ public class DispatcherHandlersMappingDescriptionProvider implements MappingDesc
|
|||
|
||||
@Override
|
||||
public List<DispatcherHandlerMappingDescription> describe(AbstractUrlHandlerMapping handlerMapping) {
|
||||
return handlerMapping.getHandlerMap().entrySet().stream().map(this::describe).collect(Collectors.toList());
|
||||
return handlerMapping.getHandlerMap().entrySet().stream().map(this::describe).toList();
|
||||
}
|
||||
|
||||
private DispatcherHandlerMappingDescription describe(Entry<PathPattern, Object> mapping) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -16,6 +16,7 @@
|
|||
|
||||
package org.springframework.boot.actuate.web.mappings.reactive;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -48,16 +49,16 @@ public class RequestMappingConditionsDescription {
|
|||
|
||||
RequestMappingConditionsDescription(RequestMappingInfo requestMapping) {
|
||||
this.consumes = requestMapping.getConsumesCondition().getExpressions().stream()
|
||||
.map(MediaTypeExpressionDescription::new).collect(Collectors.toList());
|
||||
.map(MediaTypeExpressionDescription::new).toList();
|
||||
this.headers = requestMapping.getHeadersCondition().getExpressions().stream()
|
||||
.map(NameValueExpressionDescription::new).collect(Collectors.toList());
|
||||
.map(NameValueExpressionDescription::new).toList();
|
||||
this.methods = requestMapping.getMethodsCondition().getMethods();
|
||||
this.params = requestMapping.getParamsCondition().getExpressions().stream()
|
||||
.map(NameValueExpressionDescription::new).collect(Collectors.toList());
|
||||
.map(NameValueExpressionDescription::new).toList();
|
||||
this.patterns = requestMapping.getPatternsCondition().getPatterns().stream().map(PathPattern::getPatternString)
|
||||
.collect(Collectors.toSet());
|
||||
.collect(Collectors.collectingAndThen(Collectors.toSet(), Collections::unmodifiableSet));
|
||||
this.produces = requestMapping.getProducesCondition().getExpressions().stream()
|
||||
.map(MediaTypeExpressionDescription::new).collect(Collectors.toList());
|
||||
.map(MediaTypeExpressionDescription::new).toList();
|
||||
}
|
||||
|
||||
public List<MediaTypeExpressionDescription> getConsumes() {
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.util.LinkedHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import jakarta.servlet.Servlet;
|
||||
|
@ -104,7 +103,7 @@ public class DispatcherServletsMappingDescriptionProvider implements MappingDesc
|
|||
}
|
||||
|
||||
private List<DispatcherServletMappingDescription> describeMappings(DispatcherServletHandlerMappings mappings) {
|
||||
return mappings.getHandlerMappings().stream().flatMap(this::describe).collect(Collectors.toList());
|
||||
return mappings.getHandlerMappings().stream().flatMap(this::describe).toList();
|
||||
}
|
||||
|
||||
private <T> Stream<DispatcherServletMappingDescription> describe(T handlerMapping) {
|
||||
|
@ -141,7 +140,7 @@ public class DispatcherServletsMappingDescriptionProvider implements MappingDesc
|
|||
@Override
|
||||
public List<DispatcherServletMappingDescription> describe(RequestMappingInfoHandlerMapping handlerMapping) {
|
||||
Map<RequestMappingInfo, HandlerMethod> handlerMethods = handlerMapping.getHandlerMethods();
|
||||
return handlerMethods.entrySet().stream().map(this::describe).collect(Collectors.toList());
|
||||
return handlerMethods.entrySet().stream().map(this::describe).toList();
|
||||
}
|
||||
|
||||
private DispatcherServletMappingDescription describe(Entry<RequestMappingInfo, HandlerMethod> mapping) {
|
||||
|
@ -164,7 +163,7 @@ public class DispatcherServletsMappingDescriptionProvider implements MappingDesc
|
|||
|
||||
@Override
|
||||
public List<DispatcherServletMappingDescription> describe(AbstractUrlHandlerMapping handlerMapping) {
|
||||
return handlerMapping.getHandlerMap().entrySet().stream().map(this::describe).collect(Collectors.toList());
|
||||
return handlerMapping.getHandlerMap().entrySet().stream().map(this::describe).toList();
|
||||
}
|
||||
|
||||
private DispatcherServletMappingDescription describe(Entry<String, Object> mapping) {
|
||||
|
|
|
@ -18,7 +18,6 @@ package org.springframework.boot.actuate.web.mappings.servlet;
|
|||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import jakarta.servlet.Filter;
|
||||
import jakarta.servlet.ServletContext;
|
||||
|
@ -46,7 +45,7 @@ public class FiltersMappingDescriptionProvider implements MappingDescriptionProv
|
|||
public List<FilterRegistrationMappingDescription> describeMappings(ApplicationContext context) {
|
||||
if (context instanceof WebApplicationContext webApplicationContext) {
|
||||
return webApplicationContext.getServletContext().getFilterRegistrations().values().stream()
|
||||
.map(FilterRegistrationMappingDescription::new).collect(Collectors.toList());
|
||||
.map(FilterRegistrationMappingDescription::new).toList();
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -18,7 +18,6 @@ package org.springframework.boot.actuate.web.mappings.servlet;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.servlet.mvc.condition.MediaTypeExpression;
|
||||
|
@ -48,15 +47,15 @@ public class RequestMappingConditionsDescription {
|
|||
|
||||
RequestMappingConditionsDescription(RequestMappingInfo requestMapping) {
|
||||
this.consumes = requestMapping.getConsumesCondition().getExpressions().stream()
|
||||
.map(MediaTypeExpressionDescription::new).collect(Collectors.toList());
|
||||
.map(MediaTypeExpressionDescription::new).toList();
|
||||
this.headers = requestMapping.getHeadersCondition().getExpressions().stream()
|
||||
.map(NameValueExpressionDescription::new).collect(Collectors.toList());
|
||||
.map(NameValueExpressionDescription::new).toList();
|
||||
this.methods = requestMapping.getMethodsCondition().getMethods();
|
||||
this.params = requestMapping.getParamsCondition().getExpressions().stream()
|
||||
.map(NameValueExpressionDescription::new).collect(Collectors.toList());
|
||||
.map(NameValueExpressionDescription::new).toList();
|
||||
this.patterns = extractPathPatterns(requestMapping);
|
||||
this.produces = requestMapping.getProducesCondition().getExpressions().stream()
|
||||
.map(MediaTypeExpressionDescription::new).collect(Collectors.toList());
|
||||
.map(MediaTypeExpressionDescription::new).toList();
|
||||
}
|
||||
|
||||
private Set<String> extractPathPatterns(RequestMappingInfo requestMapping) {
|
||||
|
|
|
@ -18,7 +18,6 @@ package org.springframework.boot.actuate.web.mappings.servlet;
|
|||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import jakarta.servlet.Servlet;
|
||||
import jakarta.servlet.ServletContext;
|
||||
|
@ -46,7 +45,7 @@ public class ServletsMappingDescriptionProvider implements MappingDescriptionPro
|
|||
public List<ServletRegistrationMappingDescription> describeMappings(ApplicationContext context) {
|
||||
if (context instanceof WebApplicationContext webApplicationContext) {
|
||||
return webApplicationContext.getServletContext().getServletRegistrations().values().stream()
|
||||
.map(ServletRegistrationMappingDescription::new).collect(Collectors.toList());
|
||||
.map(ServletRegistrationMappingDescription::new).toList();
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -18,7 +18,6 @@ package org.springframework.boot.actuate.beans;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -67,7 +66,7 @@ class BeansEndpointTests {
|
|||
.getAutowireCapableBeanFactory();
|
||||
List<String> infrastructureBeans = Stream.of(context.getBeanDefinitionNames())
|
||||
.filter((name) -> BeanDefinition.ROLE_INFRASTRUCTURE == factory.getBeanDefinition(name).getRole())
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
ApplicationBeans result = context.getBean(BeansEndpoint.class).beans();
|
||||
ContextBeans contextDescriptor = result.getContexts().get(context.getId());
|
||||
Map<String, BeanDescriptor> beans = contextDescriptor.getBeans();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -21,7 +21,6 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Spliterator;
|
||||
import java.util.Spliterators;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
|
@ -107,7 +106,7 @@ class OperationMethodParametersTests {
|
|||
}
|
||||
|
||||
private void assertParameters(Stream<OperationParameter> stream) {
|
||||
List<OperationParameter> parameters = stream.collect(Collectors.toList());
|
||||
List<OperationParameter> parameters = stream.toList();
|
||||
assertThat(parameters).hasSize(1);
|
||||
OperationParameter parameter = parameters.get(0);
|
||||
assertThat(parameter.getName()).isEqualTo("name");
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.util.Collection;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
@ -118,8 +117,7 @@ class ControllerEndpointDiscovererTests {
|
|||
this.contextRunner.withUserConfiguration(WithRegularEndpointConfiguration.class)
|
||||
.run(assertDiscoverer((discoverer) -> {
|
||||
Collection<ExposableControllerEndpoint> endpoints = discoverer.getEndpoints();
|
||||
List<EndpointId> ids = endpoints.stream().map(ExposableControllerEndpoint::getEndpointId)
|
||||
.collect(Collectors.toList());
|
||||
List<EndpointId> ids = endpoints.stream().map(ExposableControllerEndpoint::getEndpointId).toList();
|
||||
assertThat(ids).containsOnly(EndpointId.of("testcontroller"), EndpointId.of("testrestcontroller"));
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import jakarta.servlet.GenericServlet;
|
||||
import jakarta.servlet.ServletException;
|
||||
|
@ -100,8 +99,7 @@ class ServletEndpointDiscovererTests {
|
|||
this.contextRunner.withUserConfiguration(WithRegularEndpointConfiguration.class)
|
||||
.run(assertDiscoverer((discoverer) -> {
|
||||
Collection<ExposableServletEndpoint> endpoints = discoverer.getEndpoints();
|
||||
List<EndpointId> ids = endpoints.stream().map(ExposableServletEndpoint::getEndpointId)
|
||||
.collect(Collectors.toList());
|
||||
List<EndpointId> ids = endpoints.stream().map(ExposableServletEndpoint::getEndpointId).toList();
|
||||
assertThat(ids).containsOnly(EndpointId.of("testservlet"));
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.assertj.core.api.Condition;
|
||||
|
@ -255,7 +254,7 @@ class WebEndpointDiscovererTests {
|
|||
}
|
||||
|
||||
private List<WebOperationRequestPredicate> requestPredicates(ExposableWebEndpoint endpoint) {
|
||||
return endpoint.getOperations().stream().map(WebOperation::getRequestPredicate).collect(Collectors.toList());
|
||||
return endpoint.getOperations().stream().map(WebOperation::getRequestPredicate).toList();
|
||||
}
|
||||
|
||||
private Condition<List<? extends WebOperationRequestPredicate>> requestPredicates(
|
||||
|
|
|
@ -103,12 +103,12 @@ class DefaultWebMvcTagsProviderTests {
|
|||
@Override
|
||||
public Iterable<Tag> getTags(HttpServletRequest request, HttpServletResponse response, Object handler,
|
||||
Throwable exception) {
|
||||
return this.tagNames.stream().map((name) -> Tag.of(name, "value")).collect(Collectors.toList());
|
||||
return this.tagNames.stream().map((name) -> Tag.of(name, "value")).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Tag> getLongRequestTags(HttpServletRequest request, Object handler) {
|
||||
return this.tagNames.stream().map((name) -> Tag.of(name, "value")).collect(Collectors.toList());
|
||||
return this.tagNames.stream().map((name) -> Tag.of(name, "value")).toList();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.springframework.boot.actuate.endpoint.web.test;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
|
@ -144,7 +145,7 @@ class WebEndpointTestInvocationContextProvider implements TestTemplateInvocation
|
|||
public void beforeEach(ExtensionContext extensionContext) throws Exception {
|
||||
List<Class<?>> configurationClasses = Stream
|
||||
.of(extensionContext.getRequiredTestClass().getDeclaredClasses()).filter(this::isConfiguration)
|
||||
.collect(Collectors.toList());
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
this.context = this.contextFactory.apply(configurationClasses);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -18,7 +18,6 @@ package org.springframework.boot.actuate.info;
|
|||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.actuate.endpoint.web.test.WebEndpointTest;
|
||||
|
@ -51,7 +50,7 @@ class InfoEndpointWebIntegrationTests {
|
|||
|
||||
@Bean
|
||||
InfoEndpoint endpoint(ObjectProvider<InfoContributor> infoContributors) {
|
||||
return new InfoEndpoint(infoContributors.orderedStream().collect(Collectors.toList()));
|
||||
return new InfoEndpoint(infoContributors.orderedStream().toList());
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -71,7 +71,7 @@ class DefaultWebFluxTagsProviderTests {
|
|||
|
||||
@Override
|
||||
public Iterable<Tag> httpRequestTags(ServerWebExchange exchange, Throwable ex) {
|
||||
return this.tagNames.stream().map((name) -> Tag.of(name, "value")).collect(Collectors.toList());
|
||||
return this.tagNames.stream().map((name) -> Tag.of(name, "value")).toList();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -446,8 +446,7 @@ public class AutoConfigurationImportSelector implements DeferredImportSelector,
|
|||
processedConfigurations.removeAll(allExclusions);
|
||||
|
||||
return sortAutoConfigurations(processedConfigurations, getAutoConfigurationMetadata()).stream()
|
||||
.map((importClassName) -> new Entry(this.entries.get(importClassName), importClassName))
|
||||
.collect(Collectors.toList());
|
||||
.map((importClassName) -> new Entry(this.entries.get(importClassName), importClassName)).toList();
|
||||
}
|
||||
|
||||
private AutoConfigurationMetadata getAutoConfigurationMetadata() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -47,7 +47,7 @@ public class AutoConfigurations extends Configurations implements Ordered {
|
|||
|
||||
@Override
|
||||
protected Collection<Class<?>> sort(Collection<Class<?>> classes) {
|
||||
List<String> names = classes.stream().map(Class::getName).collect(Collectors.toList());
|
||||
List<String> names = classes.stream().map(Class::getName).toList();
|
||||
List<String> sorted = SORTER.getInPriorityOrder(names);
|
||||
return sorted.stream().map((className) -> ClassUtils.resolveClassName(className, null))
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.amqp;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.amqp.rabbit.annotation.EnableRabbit;
|
||||
import org.springframework.amqp.rabbit.config.ContainerCustomizer;
|
||||
import org.springframework.amqp.rabbit.config.DirectRabbitListenerContainerFactory;
|
||||
|
@ -69,8 +67,7 @@ class RabbitAnnotationDrivenConfiguration {
|
|||
this.properties);
|
||||
configurer.setMessageConverter(this.messageConverter.getIfUnique());
|
||||
configurer.setMessageRecoverer(this.messageRecoverer.getIfUnique());
|
||||
configurer.setRetryTemplateCustomizers(
|
||||
this.retryTemplateCustomizers.orderedStream().collect(Collectors.toList()));
|
||||
configurer.setRetryTemplateCustomizers(this.retryTemplateCustomizers.orderedStream().toList());
|
||||
return configurer;
|
||||
}
|
||||
|
||||
|
@ -94,8 +91,7 @@ class RabbitAnnotationDrivenConfiguration {
|
|||
this.properties);
|
||||
configurer.setMessageConverter(this.messageConverter.getIfUnique());
|
||||
configurer.setMessageRecoverer(this.messageRecoverer.getIfUnique());
|
||||
configurer.setRetryTemplateCustomizers(
|
||||
this.retryTemplateCustomizers.orderedStream().collect(Collectors.toList()));
|
||||
configurer.setRetryTemplateCustomizers(this.retryTemplateCustomizers.orderedStream().toList());
|
||||
return configurer;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.amqp;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.rabbitmq.client.Channel;
|
||||
import com.rabbitmq.client.impl.CredentialsProvider;
|
||||
import com.rabbitmq.client.impl.CredentialsRefreshService;
|
||||
|
@ -149,8 +147,7 @@ public class RabbitAutoConfiguration {
|
|||
ObjectProvider<RabbitRetryTemplateCustomizer> retryTemplateCustomizers) {
|
||||
RabbitTemplateConfigurer configurer = new RabbitTemplateConfigurer(properties);
|
||||
configurer.setMessageConverter(messageConverter.getIfUnique());
|
||||
configurer
|
||||
.setRetryTemplateCustomizers(retryTemplateCustomizers.orderedStream().collect(Collectors.toList()));
|
||||
configurer.setRetryTemplateCustomizers(retryTemplateCustomizers.orderedStream().toList());
|
||||
return configurer;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.cache;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
|
@ -67,7 +65,7 @@ public class CacheAutoConfiguration {
|
|||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public CacheManagerCustomizers cacheManagerCustomizers(ObjectProvider<CacheManagerCustomizer<?>> customizers) {
|
||||
return new CacheManagerCustomizers(customizers.orderedStream().collect(Collectors.toList()));
|
||||
return new CacheManagerCustomizers(customizers.orderedStream().toList());
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.util.LinkedHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
|
||||
|
@ -222,8 +221,7 @@ public class CassandraAutoConfiguration {
|
|||
private List<String> mapContactPoints(CassandraProperties properties) {
|
||||
if (properties.getContactPoints() != null) {
|
||||
return properties.getContactPoints().stream()
|
||||
.map((candidate) -> formatContactPoint(candidate, properties.getPort()))
|
||||
.collect(Collectors.toList());
|
||||
.map((candidate) -> formatContactPoint(candidate, properties.getPort())).toList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.condition;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionMessage.Style;
|
||||
import org.springframework.context.annotation.Condition;
|
||||
|
@ -51,7 +50,7 @@ class OnPropertyCondition extends SpringBootCondition {
|
|||
List<AnnotationAttributes> allAnnotationAttributes = metadata.getAnnotations()
|
||||
.stream(ConditionalOnProperty.class.getName())
|
||||
.filter(MergedAnnotationPredicates.unique(MergedAnnotation::getMetaTypes))
|
||||
.map(MergedAnnotation::asAnnotationAttributes).collect(Collectors.toList());
|
||||
.map(MergedAnnotation::asAnnotationAttributes).toList();
|
||||
List<ConditionMessage> noMatch = new ArrayList<>();
|
||||
List<ConditionMessage> match = new ArrayList<>();
|
||||
for (AnnotationAttributes annotationAttributes : allAnnotationAttributes) {
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryUtils;
|
||||
|
@ -137,7 +136,7 @@ class NoSuchBeanDefinitionFailureAnalyzer extends AbstractInjectionFailureAnalyz
|
|||
return Arrays.stream(beanNames)
|
||||
.map((beanName) -> new UserConfigurationResult(getFactoryMethodMetadata(beanName),
|
||||
this.beanFactory.getBean(beanName).equals(null)))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
private MethodMetadata getFactoryMethodMetadata(String beanName) {
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
|
@ -117,10 +116,8 @@ public class FlywayAutoConfiguration {
|
|||
FluentConfiguration configuration = new FluentConfiguration(resourceLoader.getClassLoader());
|
||||
configureDataSource(configuration, properties, flywayDataSource.getIfAvailable(), dataSource.getIfUnique());
|
||||
configureProperties(configuration, properties);
|
||||
List<Callback> orderedCallbacks = callbacks.orderedStream().collect(Collectors.toList());
|
||||
configureCallbacks(configuration, orderedCallbacks);
|
||||
List<JavaMigration> migrations = javaMigrations.stream().collect(Collectors.toList());
|
||||
configureJavaMigrations(configuration, migrations);
|
||||
configureCallbacks(configuration, callbacks.orderedStream().toList());
|
||||
configureJavaMigrations(configuration, javaMigrations.orderedStream().toList());
|
||||
fluentConfigurationCustomizers.orderedStream().forEach((customizer) -> customizer.customize(configuration));
|
||||
return configuration.load();
|
||||
}
|
||||
|
@ -282,8 +279,7 @@ public class FlywayAutoConfiguration {
|
|||
return locations;
|
||||
}
|
||||
String vendor = databaseDriver.getId();
|
||||
return locations.stream().map((location) -> location.replace(VENDOR_PLACEHOLDER, vendor))
|
||||
.collect(Collectors.toList());
|
||||
return locations.stream().map((location) -> location.replace(VENDOR_PLACEHOLDER, vendor)).toList();
|
||||
}
|
||||
|
||||
private DatabaseDriver getDatabaseDriver() {
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import graphql.GraphQL;
|
||||
import graphql.execution.instrumentation.Instrumentation;
|
||||
|
@ -84,9 +83,9 @@ public class GraphQlAutoConfiguration {
|
|||
Resource[] schemaResources = resolveSchemaResources(resourcePatternResolver, schemaLocations,
|
||||
properties.getSchema().getFileExtensions());
|
||||
GraphQlSource.SchemaResourceBuilder builder = GraphQlSource.schemaResourceBuilder()
|
||||
.schemaResources(schemaResources).exceptionResolvers(toList(exceptionResolvers))
|
||||
.subscriptionExceptionResolvers(toList(subscriptionExceptionResolvers))
|
||||
.instrumentation(toList(instrumentations));
|
||||
.schemaResources(schemaResources).exceptionResolvers(exceptionResolvers.orderedStream().toList())
|
||||
.subscriptionExceptionResolvers(subscriptionExceptionResolvers.orderedStream().toList())
|
||||
.instrumentation(instrumentations.orderedStream().toList());
|
||||
if (!properties.getSchema().getIntrospection().isEnabled()) {
|
||||
builder.configureRuntimeWiring(this::enableIntrospection);
|
||||
}
|
||||
|
@ -144,8 +143,4 @@ public class GraphQlAutoConfiguration {
|
|||
return controllerConfigurer;
|
||||
}
|
||||
|
||||
private <T> List<T> toList(ObjectProvider<T> provider) {
|
||||
return provider.orderedStream().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.graphql.data;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.graphql.GraphQlSourceBuilderCustomizer;
|
||||
|
@ -47,15 +46,13 @@ class GraphQlQuerydslSourceBuilderCustomizer<E, R> implements GraphQlSourceBuild
|
|||
GraphQlQuerydslSourceBuilderCustomizer(
|
||||
BiFunction<List<E>, List<R>, RuntimeWiringConfigurer> wiringConfigurerFactory, ObjectProvider<E> executors,
|
||||
ObjectProvider<R> reactiveExecutors) {
|
||||
this(wiringConfigurerFactory, toList(executors), toList(reactiveExecutors));
|
||||
this.wiringConfigurerFactory = wiringConfigurerFactory;
|
||||
this.executors = asList(executors);
|
||||
this.reactiveExecutors = asList(reactiveExecutors);
|
||||
}
|
||||
|
||||
GraphQlQuerydslSourceBuilderCustomizer(
|
||||
BiFunction<List<E>, List<R>, RuntimeWiringConfigurer> wiringConfigurerFactory, List<E> executors,
|
||||
List<R> reactiveExecutors) {
|
||||
this.wiringConfigurerFactory = wiringConfigurerFactory;
|
||||
this.executors = executors;
|
||||
this.reactiveExecutors = reactiveExecutors;
|
||||
private static <T> List<T> asList(ObjectProvider<T> provider) {
|
||||
return (provider != null) ? provider.orderedStream().toList() : Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -65,8 +62,4 @@ class GraphQlQuerydslSourceBuilderCustomizer<E, R> implements GraphQlSourceBuild
|
|||
}
|
||||
}
|
||||
|
||||
private static <T> List<T> toList(ObjectProvider<T> provider) {
|
||||
return (provider != null) ? provider.orderedStream().collect(Collectors.toList()) : Collections.emptyList();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package org.springframework.boot.autoconfigure.graphql.reactive;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import graphql.GraphQL;
|
||||
import org.apache.commons.logging.Log;
|
||||
|
@ -96,9 +95,8 @@ public class GraphQlWebFluxAutoConfiguration {
|
|||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public WebGraphQlHandler webGraphQlHandler(ExecutionGraphQlService service,
|
||||
ObjectProvider<WebGraphQlInterceptor> interceptorsProvider) {
|
||||
return WebGraphQlHandler.builder(service)
|
||||
.interceptors(interceptorsProvider.orderedStream().collect(Collectors.toList())).build();
|
||||
ObjectProvider<WebGraphQlInterceptor> interceptors) {
|
||||
return WebGraphQlHandler.builder(service).interceptors(interceptors.orderedStream().toList()).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -16,9 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.graphql.rsocket;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import graphql.GraphQL;
|
||||
import io.rsocket.core.RSocketServer;
|
||||
|
@ -58,10 +55,9 @@ public class GraphQlRSocketAutoConfiguration {
|
|||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public GraphQlRSocketHandler graphQlRSocketHandler(ExecutionGraphQlService graphQlService,
|
||||
ObjectProvider<RSocketGraphQlInterceptor> interceptorsProvider, ObjectMapper objectMapper) {
|
||||
List<RSocketGraphQlInterceptor> interceptors = interceptorsProvider.orderedStream()
|
||||
.collect(Collectors.toList());
|
||||
return new GraphQlRSocketHandler(graphQlService, interceptors, new Jackson2JsonEncoder(objectMapper));
|
||||
ObjectProvider<RSocketGraphQlInterceptor> interceptors, ObjectMapper objectMapper) {
|
||||
return new GraphQlRSocketHandler(graphQlService, interceptors.orderedStream().toList(),
|
||||
new Jackson2JsonEncoder(objectMapper));
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -18,7 +18,6 @@ package org.springframework.boot.autoconfigure.graphql.servlet;
|
|||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import graphql.GraphQL;
|
||||
import jakarta.websocket.server.ServerContainer;
|
||||
|
@ -97,9 +96,8 @@ public class GraphQlWebMvcAutoConfiguration {
|
|||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public WebGraphQlHandler webGraphQlHandler(ExecutionGraphQlService service,
|
||||
ObjectProvider<WebGraphQlInterceptor> interceptorsProvider) {
|
||||
return WebGraphQlHandler.builder(service)
|
||||
.interceptors(interceptorsProvider.orderedStream().collect(Collectors.toList())).build();
|
||||
ObjectProvider<WebGraphQlInterceptor> interceptors) {
|
||||
return WebGraphQlHandler.builder(service).interceptors(interceptors.orderedStream().toList()).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.h2;
|
|||
import java.sql.Connection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
|
@ -39,6 +38,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.log.LogMessage;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for H2's web console.
|
||||
|
@ -83,20 +83,19 @@ public class H2ConsoleAutoConfiguration {
|
|||
}
|
||||
|
||||
private void logDataSources(ObjectProvider<DataSource> dataSource, String path) {
|
||||
List<String> urls = dataSource.orderedStream().map((available) -> {
|
||||
try (Connection connection = available.getConnection()) {
|
||||
return "'" + connection.getMetaData().getURL() + "'";
|
||||
}
|
||||
catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
List<String> urls = dataSource.orderedStream().map(this::getConnectionUrl).filter(Objects::nonNull).toList();
|
||||
if (!urls.isEmpty()) {
|
||||
StringBuilder sb = new StringBuilder("H2 console available at '").append(path).append("'. ");
|
||||
String tmp = (urls.size() > 1) ? "Databases" : "Database";
|
||||
sb.append(tmp).append(" available at ");
|
||||
sb.append(String.join(", ", urls));
|
||||
logger.info(sb.toString());
|
||||
logger.info(LogMessage.format("H2 console available at '%s'. %s available at %s", path,
|
||||
(urls.size() > 1) ? "Databases" : "Database", String.join(", ", urls)));
|
||||
}
|
||||
}
|
||||
|
||||
private String getConnectionUrl(DataSource dataSource) {
|
||||
try (Connection connection = dataSource.getConnection()) {
|
||||
return "'" + connection.getMetaData().getURL() + "'";
|
||||
}
|
||||
catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.http;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.aot.hint.RuntimeHints;
|
||||
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
|
@ -73,7 +71,7 @@ public class HttpMessageConvertersAutoConfiguration {
|
|||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public HttpMessageConverters messageConverters(ObjectProvider<HttpMessageConverter<?>> converters) {
|
||||
return new HttpMessageConverters(converters.orderedStream().collect(Collectors.toList()));
|
||||
return new HttpMessageConverters(converters.orderedStream().toList());
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
|
|
|
@ -16,9 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.jms.artemis;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.activemq.artemis.api.core.QueueConfiguration;
|
||||
import org.apache.activemq.artemis.api.core.RoutingType;
|
||||
import org.apache.activemq.artemis.core.config.CoreAddressConfiguration;
|
||||
|
@ -90,19 +87,13 @@ class ArtemisEmbeddedServerConfiguration {
|
|||
JMSConfiguration artemisJmsConfiguration(ObjectProvider<JMSQueueConfiguration> queuesConfiguration,
|
||||
ObjectProvider<TopicConfiguration> topicsConfiguration) {
|
||||
JMSConfiguration configuration = new JMSConfigurationImpl();
|
||||
addAll(configuration.getQueueConfigurations(), queuesConfiguration);
|
||||
addAll(configuration.getTopicConfigurations(), topicsConfiguration);
|
||||
configuration.getQueueConfigurations().addAll(queuesConfiguration.orderedStream().toList());
|
||||
configuration.getTopicConfigurations().addAll(topicsConfiguration.orderedStream().toList());
|
||||
addQueues(configuration, this.properties.getEmbedded().getQueues());
|
||||
addTopics(configuration, this.properties.getEmbedded().getTopics());
|
||||
return configuration;
|
||||
}
|
||||
|
||||
private <T> void addAll(List<T> list, ObjectProvider<T> items) {
|
||||
if (items != null) {
|
||||
list.addAll(items.orderedStream().collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
|
||||
private void addQueues(JMSConfiguration configuration, String[] queues) {
|
||||
boolean persistent = this.properties.getEmbedded().isPersistent();
|
||||
for (String queue : queues) {
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcome;
|
||||
|
@ -72,7 +71,7 @@ public class ConditionEvaluationReportMessage {
|
|||
message.append(String.format("Positive matches:%n"));
|
||||
message.append(String.format("-----------------%n"));
|
||||
List<Entry<String, ConditionAndOutcomes>> matched = shortOutcomes.entrySet().stream()
|
||||
.filter((entry) -> entry.getValue().isFullMatch()).collect(Collectors.toList());
|
||||
.filter((entry) -> entry.getValue().isFullMatch()).toList();
|
||||
if (matched.isEmpty()) {
|
||||
message.append(String.format("%n None%n"));
|
||||
}
|
||||
|
@ -86,7 +85,7 @@ public class ConditionEvaluationReportMessage {
|
|||
message.append(String.format("Negative matches:%n"));
|
||||
message.append(String.format("-----------------%n"));
|
||||
List<Entry<String, ConditionAndOutcomes>> nonMatched = shortOutcomes.entrySet().stream()
|
||||
.filter((entry) -> !entry.getValue().isFullMatch()).collect(Collectors.toList());
|
||||
.filter((entry) -> !entry.getValue().isFullMatch()).toList();
|
||||
if (nonMatched.isEmpty()) {
|
||||
message.append(String.format("%n None%n"));
|
||||
}
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.mongo;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.mongodb.MongoClientSettings;
|
||||
import com.mongodb.client.MongoClient;
|
||||
|
||||
|
@ -51,8 +49,7 @@ public class MongoAutoConfiguration {
|
|||
@ConditionalOnMissingBean(MongoClient.class)
|
||||
public MongoClient mongo(ObjectProvider<MongoClientSettingsBuilderCustomizer> builderCustomizers,
|
||||
MongoClientSettings settings) {
|
||||
return new MongoClientFactory(builderCustomizers.orderedStream().collect(Collectors.toList()))
|
||||
.createMongoClient(settings);
|
||||
return new MongoClientFactory(builderCustomizers.orderedStream().toList()).createMongoClient(settings);
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.mongo;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.mongodb.MongoClientSettings;
|
||||
import com.mongodb.MongoClientSettings.Builder;
|
||||
import com.mongodb.connection.netty.NettyStreamFactoryFactory;
|
||||
|
@ -57,7 +55,7 @@ public class MongoReactiveAutoConfiguration {
|
|||
public MongoClient reactiveStreamsMongoClient(
|
||||
ObjectProvider<MongoClientSettingsBuilderCustomizer> builderCustomizers, MongoClientSettings settings) {
|
||||
ReactiveMongoClientFactory factory = new ReactiveMongoClientFactory(
|
||||
builderCustomizers.orderedStream().collect(Collectors.toList()));
|
||||
builderCustomizers.orderedStream().toList());
|
||||
return factory.createMongoClient(settings);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.time.Duration;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.neo4j.driver.AuthToken;
|
||||
import org.neo4j.driver.AuthTokens;
|
||||
|
@ -64,8 +63,7 @@ public class Neo4jAutoConfiguration {
|
|||
public Driver neo4jDriver(Neo4jProperties properties, Environment environment,
|
||||
ObjectProvider<ConfigBuilderCustomizer> configBuilderCustomizers) {
|
||||
AuthToken authToken = mapAuthToken(properties.getAuthentication(), environment);
|
||||
Config config = mapDriverConfig(properties,
|
||||
configBuilderCustomizers.orderedStream().collect(Collectors.toList()));
|
||||
Config config = mapDriverConfig(properties, configBuilderCustomizers.orderedStream().toList());
|
||||
URI serverUri = determineServerUri(properties, environment);
|
||||
return GraphDatabase.driver(serverUri, authToken, config);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -23,7 +23,6 @@ import java.util.LinkedHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
|
@ -99,7 +98,7 @@ class HibernateJpaConfiguration extends JpaBaseConfiguration {
|
|||
this.poolMetadataProvider = new CompositeDataSourcePoolMetadataProvider(metadataProviders.getIfAvailable());
|
||||
this.hibernatePropertiesCustomizers = determineHibernatePropertiesCustomizers(
|
||||
physicalNamingStrategy.getIfAvailable(), implicitNamingStrategy.getIfAvailable(), beanFactory,
|
||||
hibernatePropertiesCustomizers.orderedStream().collect(Collectors.toList()));
|
||||
hibernatePropertiesCustomizers.orderedStream().toList());
|
||||
}
|
||||
|
||||
private List<HibernatePropertiesCustomizer> determineHibernatePropertiesCustomizers(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -17,7 +17,6 @@
|
|||
package org.springframework.boot.autoconfigure.r2dbc;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.r2dbc.pool.ConnectionPool;
|
||||
import io.r2dbc.pool.ConnectionPoolConfiguration;
|
||||
|
@ -90,7 +89,7 @@ abstract class ConnectionFactoryConfigurations {
|
|||
ConnectionPool connectionFactory(R2dbcProperties properties, ResourceLoader resourceLoader,
|
||||
ObjectProvider<ConnectionFactoryOptionsBuilderCustomizer> customizers) {
|
||||
ConnectionFactory connectionFactory = createConnectionFactory(properties,
|
||||
resourceLoader.getClassLoader(), customizers.orderedStream().collect(Collectors.toList()));
|
||||
resourceLoader.getClassLoader(), customizers.orderedStream().toList());
|
||||
R2dbcProperties.Pool pool = properties.getPool();
|
||||
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
|
||||
ConnectionPoolConfiguration.Builder builder = ConnectionPoolConfiguration.builder(connectionFactory);
|
||||
|
@ -119,7 +118,7 @@ abstract class ConnectionFactoryConfigurations {
|
|||
ConnectionFactory connectionFactory(R2dbcProperties properties, ResourceLoader resourceLoader,
|
||||
ObjectProvider<ConnectionFactoryOptionsBuilderCustomizer> customizers) {
|
||||
return createConnectionFactory(properties, resourceLoader.getClassLoader(),
|
||||
customizers.orderedStream().collect(Collectors.toList()));
|
||||
customizers.orderedStream().toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.rsocket;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.rsocket.core.RSocketServer;
|
||||
import io.rsocket.frame.decoder.PayloadDecoder;
|
||||
import io.rsocket.transport.netty.server.TcpServerTransport;
|
||||
|
@ -99,7 +97,7 @@ public class RSocketServerAutoConfiguration {
|
|||
map.from(properties.getServer().getPort()).to(factory::setPort);
|
||||
map.from(properties.getServer().getFragmentSize()).to(factory::setFragmentSize);
|
||||
map.from(properties.getServer().getSsl()).to(factory::setSsl);
|
||||
factory.setRSocketServerCustomizers(customizers.orderedStream().collect(Collectors.toList()));
|
||||
factory.setRSocketServerCustomizers(customizers.orderedStream().toList());
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -17,7 +17,6 @@
|
|||
package org.springframework.boot.autoconfigure.rsocket;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import io.rsocket.SocketAcceptor;
|
||||
|
@ -46,7 +45,7 @@ class RSocketWebSocketNettyRouteProvider implements NettyRouteProvider {
|
|||
Stream<RSocketServerCustomizer> customizers) {
|
||||
this.mappingPath = mappingPath;
|
||||
this.socketAcceptor = socketAcceptor;
|
||||
this.customizers = customizers.collect(Collectors.toList());
|
||||
this.customizers = customizers.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -18,9 +18,7 @@ package org.springframework.boot.autoconfigure.security.reactive;
|
|||
|
||||
import java.util.EnumSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import reactor.core.publisher.Mono;
|
||||
|
@ -123,18 +121,17 @@ public final class StaticResourceRequest {
|
|||
return new StaticResourceServerWebExchange(subset);
|
||||
}
|
||||
|
||||
private List<ServerWebExchangeMatcher> getDelegateMatchers() {
|
||||
return getPatterns().map(PathPatternParserServerWebExchangeMatcher::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private Stream<String> getPatterns() {
|
||||
return this.locations.stream().flatMap(StaticResourceLocation::getPatterns);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<MatchResult> matches(ServerWebExchange exchange) {
|
||||
OrServerWebExchangeMatcher matcher = new OrServerWebExchangeMatcher(getDelegateMatchers());
|
||||
return matcher.matches(exchange);
|
||||
return new OrServerWebExchangeMatcher(getDelegateMatchers().toList()).matches(exchange);
|
||||
}
|
||||
|
||||
private Stream<ServerWebExchangeMatcher> getDelegateMatchers() {
|
||||
return getPatterns().map(PathPatternParserServerWebExchangeMatcher::new);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.security.interfaces.RSAPrivateKey;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.security.saml2.Saml2RelyingPartyProperties.AssertingParty;
|
||||
|
@ -64,7 +63,7 @@ class Saml2RelyingPartyRegistrationConfiguration {
|
|||
@Bean
|
||||
RelyingPartyRegistrationRepository relyingPartyRegistrationRepository(Saml2RelyingPartyProperties properties) {
|
||||
List<RelyingPartyRegistration> registrations = properties.getRegistration().entrySet().stream()
|
||||
.map(this::asRegistration).collect(Collectors.toList());
|
||||
.map(this::asRegistration).toList();
|
||||
return new InMemoryRelyingPartyRegistrationRepository(registrations);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -18,10 +18,8 @@ package org.springframework.boot.autoconfigure.security.servlet;
|
|||
|
||||
import java.util.EnumSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
@ -134,11 +132,11 @@ public final class StaticResourceRequest {
|
|||
|
||||
@Override
|
||||
protected void initialized(Supplier<DispatcherServletPath> dispatcherServletPath) {
|
||||
this.delegate = new OrRequestMatcher(getDelegateMatchers(dispatcherServletPath.get()));
|
||||
this.delegate = new OrRequestMatcher(getDelegateMatchers(dispatcherServletPath.get()).toList());
|
||||
}
|
||||
|
||||
private List<RequestMatcher> getDelegateMatchers(DispatcherServletPath dispatcherServletPath) {
|
||||
return getPatterns(dispatcherServletPath).map(AntPathRequestMatcher::new).collect(Collectors.toList());
|
||||
private Stream<RequestMatcher> getDelegateMatchers(DispatcherServletPath dispatcherServletPath) {
|
||||
return getPatterns(dispatcherServletPath).map(AntPathRequestMatcher::new);
|
||||
}
|
||||
|
||||
private Stream<String> getPatterns(DispatcherServletPath dispatcherServletPath) {
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.transaction;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
|
@ -58,7 +56,7 @@ public class TransactionAutoConfiguration {
|
|||
@ConditionalOnMissingBean
|
||||
public TransactionManagerCustomizers platformTransactionManagerCustomizers(
|
||||
ObjectProvider<PlatformTransactionManagerCustomizer<?>> customizers) {
|
||||
return new TransactionManagerCustomizers(customizers.orderedStream().collect(Collectors.toList()));
|
||||
return new TransactionManagerCustomizers(customizers.orderedStream().toList());
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.web.client;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
|
@ -58,9 +56,8 @@ public class RestTemplateAutoConfiguration {
|
|||
ObjectProvider<RestTemplateRequestCustomizer<?>> restTemplateRequestCustomizers) {
|
||||
RestTemplateBuilderConfigurer configurer = new RestTemplateBuilderConfigurer();
|
||||
configurer.setHttpMessageConverters(messageConverters.getIfUnique());
|
||||
configurer.setRestTemplateCustomizers(restTemplateCustomizers.orderedStream().collect(Collectors.toList()));
|
||||
configurer.setRestTemplateRequestCustomizers(
|
||||
restTemplateRequestCustomizers.orderedStream().collect(Collectors.toList()));
|
||||
configurer.setRestTemplateCustomizers(restTemplateCustomizers.orderedStream().toList());
|
||||
configurer.setRestTemplateRequestCustomizers(restTemplateRequestCustomizers.orderedStream().toList());
|
||||
return configurer;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2022 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.
|
||||
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.web.reactive;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.undertow.Undertow;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import reactor.netty.http.server.HttpServer;
|
||||
|
@ -71,7 +69,7 @@ abstract class ReactiveWebServerFactoryConfiguration {
|
|||
NettyReactiveWebServerFactory serverFactory = new NettyReactiveWebServerFactory();
|
||||
serverFactory.setResourceFactory(resourceFactory);
|
||||
routes.orderedStream().forEach(serverFactory::addRouteProviders);
|
||||
serverFactory.getServerCustomizers().addAll(serverCustomizers.orderedStream().collect(Collectors.toList()));
|
||||
serverFactory.getServerCustomizers().addAll(serverCustomizers.orderedStream().toList());
|
||||
return serverFactory;
|
||||
}
|
||||
|
||||
|
@ -88,12 +86,9 @@ abstract class ReactiveWebServerFactoryConfiguration {
|
|||
ObjectProvider<TomcatContextCustomizer> contextCustomizers,
|
||||
ObjectProvider<TomcatProtocolHandlerCustomizer<?>> protocolHandlerCustomizers) {
|
||||
TomcatReactiveWebServerFactory factory = new TomcatReactiveWebServerFactory();
|
||||
factory.getTomcatConnectorCustomizers()
|
||||
.addAll(connectorCustomizers.orderedStream().collect(Collectors.toList()));
|
||||
factory.getTomcatContextCustomizers()
|
||||
.addAll(contextCustomizers.orderedStream().collect(Collectors.toList()));
|
||||
factory.getTomcatProtocolHandlerCustomizers()
|
||||
.addAll(protocolHandlerCustomizers.orderedStream().collect(Collectors.toList()));
|
||||
factory.getTomcatConnectorCustomizers().addAll(connectorCustomizers.orderedStream().toList());
|
||||
factory.getTomcatContextCustomizers().addAll(contextCustomizers.orderedStream().toList());
|
||||
factory.getTomcatProtocolHandlerCustomizers().addAll(protocolHandlerCustomizers.orderedStream().toList());
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
@ -114,7 +109,7 @@ abstract class ReactiveWebServerFactoryConfiguration {
|
|||
JettyReactiveWebServerFactory jettyReactiveWebServerFactory(JettyResourceFactory resourceFactory,
|
||||
ObjectProvider<JettyServerCustomizer> serverCustomizers) {
|
||||
JettyReactiveWebServerFactory serverFactory = new JettyReactiveWebServerFactory();
|
||||
serverFactory.getServerCustomizers().addAll(serverCustomizers.orderedStream().collect(Collectors.toList()));
|
||||
serverFactory.getServerCustomizers().addAll(serverCustomizers.orderedStream().toList());
|
||||
serverFactory.setResourceFactory(resourceFactory);
|
||||
return serverFactory;
|
||||
}
|
||||
|
@ -130,7 +125,7 @@ abstract class ReactiveWebServerFactoryConfiguration {
|
|||
UndertowReactiveWebServerFactory undertowReactiveWebServerFactory(
|
||||
ObjectProvider<UndertowBuilderCustomizer> builderCustomizers) {
|
||||
UndertowReactiveWebServerFactory factory = new UndertowReactiveWebServerFactory();
|
||||
factory.getBuilderCustomizers().addAll(builderCustomizers.orderedStream().collect(Collectors.toList()));
|
||||
factory.getBuilderCustomizers().addAll(builderCustomizers.orderedStream().toList());
|
||||
return factory;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.web.reactive.error;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
|
@ -67,7 +65,7 @@ public class ErrorWebFluxAutoConfiguration {
|
|||
ServerCodecConfigurer serverCodecConfigurer, ApplicationContext applicationContext) {
|
||||
DefaultErrorWebExceptionHandler exceptionHandler = new DefaultErrorWebExceptionHandler(errorAttributes,
|
||||
webProperties.getResources(), this.serverProperties.getError(), applicationContext);
|
||||
exceptionHandler.setViewResolvers(viewResolvers.orderedStream().collect(Collectors.toList()));
|
||||
exceptionHandler.setViewResolvers(viewResolvers.orderedStream().toList());
|
||||
exceptionHandler.setMessageWriters(serverCodecConfigurer.getWriters());
|
||||
exceptionHandler.setMessageReaders(serverCodecConfigurer.getReaders());
|
||||
return exceptionHandler;
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.web.reactive.function.client;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
|
@ -65,7 +63,7 @@ public class WebClientAutoConfiguration {
|
|||
@ConditionalOnMissingBean
|
||||
@Order(0)
|
||||
public WebClientCodecCustomizer exchangeStrategiesCustomizer(ObjectProvider<CodecCustomizer> codecCustomizers) {
|
||||
return new WebClientCodecCustomizer(codecCustomizers.orderedStream().collect(Collectors.toList()));
|
||||
return new WebClientCodecCustomizer(codecCustomizers.orderedStream().toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue