Browse Source

Merge branch '3.2.x'

Closes gh-41077
pull/41083/head
Phillip Webb 2 years ago
parent
commit
255bcc28e6
  1. 3
      buildSrc/src/main/java/org/springframework/boot/build/toolchain/ToolchainPlugin.java
  2. 5
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProvider.java
  3. 2
      spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/vanilla/MyIntegrationTests.kt
  4. 3
      spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/serviceconnections/MyIntegrationTests.kt
  5. 3
      spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java
  6. 6
      spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/service/connection/ServiceConnectionAutoConfigurationRegistrar.java
  7. 3
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigData.java
  8. 5
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TldPatterns.java
  9. 5
      spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedContext.java

3
buildSrc/src/main/java/org/springframework/boot/build/toolchain/ToolchainPlugin.java

@ -71,8 +71,7 @@ public class ToolchainPlugin implements Plugin<Project> { @@ -71,8 +71,7 @@ public class ToolchainPlugin implements Plugin<Project> {
}
private void configureTestToolchain(Project project, ToolchainExtension toolchain) {
List<String> jvmArgs = new ArrayList<>();
jvmArgs.addAll(toolchain.getTestJvmArgs().getOrElse(Collections.emptyList()));
List<String> jvmArgs = new ArrayList<>(toolchain.getTestJvmArgs().getOrElse(Collections.emptyList()));
project.getTasks().withType(Test.class, (test) -> test.jvmArgs(jvmArgs));
}

5
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProvider.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 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.
@ -96,8 +96,7 @@ class NativeImageResourceProvider implements ResourceProvider { @@ -96,8 +96,7 @@ class NativeImageResourceProvider implements ResourceProvider {
ensureInitialized();
Predicate<LocatedResource> matchesPrefixAndSuffixes = (locatedResource) -> StringUtils
.startsAndEndsWith(locatedResource.resource.getFilename(), prefix, suffixes);
List<LoadableResource> result = new ArrayList<>();
result.addAll(this.scanner.getResources(prefix, suffixes));
List<LoadableResource> result = new ArrayList<>(this.scanner.getResources(prefix, suffixes));
this.locatedResources.stream()
.filter(matchesPrefixAndSuffixes)
.map(this::asClassPathResource)

2
spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/vanilla/MyIntegrationTests.kt

@ -32,8 +32,10 @@ class MyIntegrationTests { @@ -32,8 +32,10 @@ class MyIntegrationTests {
}
companion object {
@Container
val neo4j = Neo4jContainer("neo4j:5")
}
}

3
spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/serviceconnections/MyIntegrationTests.kt

@ -34,9 +34,12 @@ class MyIntegrationTests { @@ -34,9 +34,12 @@ class MyIntegrationTests {
}
companion object {
@Container
@ServiceConnection
@JvmStatic
val neo4j = Neo4jContainer("neo4j:5");
}
}

3
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java

@ -240,8 +240,7 @@ class ImportsContextCustomizer implements ContextCustomizer { @@ -240,8 +240,7 @@ class ImportsContextCustomizer implements ContextCustomizer {
this.key = Collections.unmodifiableSet(synthesize(annotations));
}
else {
Set<Object> key = new HashSet<>();
key.addAll(determinedImports);
Set<Object> key = new HashSet<>(determinedImports);
Set<Annotation> componentScanning = annotations.stream()
.filter((annotation) -> annotation.getType().equals(ComponentScan.class))
.map(MergedAnnotation::synthesize)

6
spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/service/connection/ServiceConnectionAutoConfigurationRegistrar.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 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.
@ -68,8 +68,8 @@ class ServiceConnectionAutoConfigurationRegistrar implements ImportBeanDefinitio @@ -68,8 +68,8 @@ class ServiceConnectionAutoConfigurationRegistrar implements ImportBeanDefinitio
private Set<ServiceConnection> getAnnotations(ConfigurableListableBeanFactory beanFactory, String beanName,
BeanDefinition beanDefinition) {
Set<ServiceConnection> annotations = new LinkedHashSet<>();
annotations.addAll(beanFactory.findAllAnnotationsOnBean(beanName, ServiceConnection.class, false));
Set<ServiceConnection> annotations = new LinkedHashSet<>(
beanFactory.findAllAnnotationsOnBean(beanName, ServiceConnection.class, false));
if (beanDefinition instanceof TestcontainerBeanDefinition testcontainerBeanDefinition) {
testcontainerBeanDefinition.getAnnotations()
.stream(ServiceConnection.class)

3
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigData.java

@ -239,8 +239,7 @@ public final class ConfigData { @@ -239,8 +239,7 @@ public final class ConfigData {
}
private Options copy(Consumer<EnumSet<Option>> processor) {
EnumSet<Option> options = EnumSet.noneOf(Option.class);
options.addAll(this.options);
EnumSet<Option> options = EnumSet.copyOf(this.options);
processor.accept(options);
return new Options(options);
}

5
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TldPatterns.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 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.
@ -195,8 +195,7 @@ final class TldPatterns { @@ -195,8 +195,7 @@ final class TldPatterns {
static final Set<String> DEFAULT_SCAN;
static {
Set<String> scanPatterns = new LinkedHashSet<>();
scanPatterns.addAll(TOMCAT_SCAN);
Set<String> scanPatterns = new LinkedHashSet<>(TOMCAT_SCAN);
DEFAULT_SCAN = Collections.unmodifiableSet(scanPatterns);
}

5
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedContext.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2024 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.
@ -128,8 +128,7 @@ class TomcatEmbeddedContext extends StandardContext { @@ -128,8 +128,7 @@ class TomcatEmbeddedContext extends StandardContext {
@Override
public String[] findMimeMappings() {
List<String> mappings = new ArrayList<>();
mappings.addAll(Arrays.asList(super.findMimeMappings()));
List<String> mappings = new ArrayList<>(Arrays.asList(super.findMimeMappings()));
if (this.mimeMappings != null) {
this.mimeMappings.forEach((mapping) -> mappings.add(mapping.getExtension()));
}

Loading…
Cancel
Save