Merge branch '3.2.x'

Closes gh-41077
This commit is contained in:
Phillip Webb 2024-06-11 10:48:52 -07:00
commit 255bcc28e6
9 changed files with 17 additions and 18 deletions

View File

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

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -96,8 +96,7 @@ class NativeImageResourceProvider implements ResourceProvider {
ensureInitialized(); ensureInitialized();
Predicate<LocatedResource> matchesPrefixAndSuffixes = (locatedResource) -> StringUtils Predicate<LocatedResource> matchesPrefixAndSuffixes = (locatedResource) -> StringUtils
.startsAndEndsWith(locatedResource.resource.getFilename(), prefix, suffixes); .startsAndEndsWith(locatedResource.resource.getFilename(), prefix, suffixes);
List<LoadableResource> result = new ArrayList<>(); List<LoadableResource> result = new ArrayList<>(this.scanner.getResources(prefix, suffixes));
result.addAll(this.scanner.getResources(prefix, suffixes));
this.locatedResources.stream() this.locatedResources.stream()
.filter(matchesPrefixAndSuffixes) .filter(matchesPrefixAndSuffixes)
.map(this::asClassPathResource) .map(this::asClassPathResource)

View File

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

View File

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

View File

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

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -68,8 +68,8 @@ class ServiceConnectionAutoConfigurationRegistrar implements ImportBeanDefinitio
private Set<ServiceConnection> getAnnotations(ConfigurableListableBeanFactory beanFactory, String beanName, private Set<ServiceConnection> getAnnotations(ConfigurableListableBeanFactory beanFactory, String beanName,
BeanDefinition beanDefinition) { BeanDefinition beanDefinition) {
Set<ServiceConnection> annotations = new LinkedHashSet<>(); Set<ServiceConnection> annotations = new LinkedHashSet<>(
annotations.addAll(beanFactory.findAllAnnotationsOnBean(beanName, ServiceConnection.class, false)); beanFactory.findAllAnnotationsOnBean(beanName, ServiceConnection.class, false));
if (beanDefinition instanceof TestcontainerBeanDefinition testcontainerBeanDefinition) { if (beanDefinition instanceof TestcontainerBeanDefinition testcontainerBeanDefinition) {
testcontainerBeanDefinition.getAnnotations() testcontainerBeanDefinition.getAnnotations()
.stream(ServiceConnection.class) .stream(ServiceConnection.class)

View File

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

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -195,8 +195,7 @@ final class TldPatterns {
static final Set<String> DEFAULT_SCAN; static final Set<String> DEFAULT_SCAN;
static { static {
Set<String> scanPatterns = new LinkedHashSet<>(); Set<String> scanPatterns = new LinkedHashSet<>(TOMCAT_SCAN);
scanPatterns.addAll(TOMCAT_SCAN);
DEFAULT_SCAN = Collections.unmodifiableSet(scanPatterns); DEFAULT_SCAN = Collections.unmodifiableSet(scanPatterns);
} }

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -128,8 +128,7 @@ class TomcatEmbeddedContext extends StandardContext {
@Override @Override
public String[] findMimeMappings() { public String[] findMimeMappings() {
List<String> mappings = new ArrayList<>(); List<String> mappings = new ArrayList<>(Arrays.asList(super.findMimeMappings()));
mappings.addAll(Arrays.asList(super.findMimeMappings()));
if (this.mimeMappings != null) { if (this.mimeMappings != null) {
this.mimeMappings.forEach((mapping) -> mappings.add(mapping.getExtension())); this.mimeMappings.forEach((mapping) -> mappings.add(mapping.getExtension()));
} }