From a5ee37c5262270a8d6a0e898a441f35677310d59 Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Thu, 23 May 2024 13:35:14 +0200 Subject: [PATCH 001/108] Next development version (v3.2.7-SNAPSHOT) --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 37c729ff2ae7..56caefede548 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=3.2.6-SNAPSHOT +version=3.2.7-SNAPSHOT org.gradle.caching=true org.gradle.parallel=true From c857eb62d483865bc260ea1becab4bb456468772 Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Thu, 23 May 2024 13:53:38 +0200 Subject: [PATCH 002/108] Fix SDKman "make default" step The supported HTTP verb is PUT, not POST, see https://sdkman.io/vendors --- .github/actions/publish-to-sdkman/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/publish-to-sdkman/action.yml b/.github/actions/publish-to-sdkman/action.yml index 2d23b18232bc..7458c863ac57 100644 --- a/.github/actions/publish-to-sdkman/action.yml +++ b/.github/actions/publish-to-sdkman/action.yml @@ -29,7 +29,7 @@ runs: - shell: bash if: ${{ inputs.make-default == 'true' }} run: > - curl -X POST \ + curl -X PUT \ -H "Consumer-Key: ${{ inputs.sdkman-consumer-key }}" \ -H "Consumer-Token: ${{ inputs.sdkman-consumer-token }}" \ -H "Content-Type: application/json" \ From 234e0fd1f395ed284cd8b4726c9b73d695c28b27 Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Thu, 23 May 2024 13:57:22 +0200 Subject: [PATCH 003/108] Stop mark 3.2.x as the default SDKman release Closes gh-40883 --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7c2effc3e462..620b4f6455e9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -104,7 +104,7 @@ jobs: - name: Publish to SDKMAN! uses: ./.github/actions/publish-to-sdkman with: - make-default: true + make-default: false sdkman-consumer-key: ${{ secrets.SDKMAN_CONSUMER_KEY }} sdkman-consumer-token: ${{ secrets.SDKMAN_CONSUMER_TOKEN }} spring-boot-version: ${{ needs.build-and-stage-release.outputs.version }} From 7cd1f0ab3b28862fcc40dd1674d667161d44c28d Mon Sep 17 00:00:00 2001 From: Scott Frederick Date: Thu, 23 May 2024 14:51:02 -0500 Subject: [PATCH 004/108] Polish JVM thread dump action --- .github/actions/print-jvm-thread-dumps/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/print-jvm-thread-dumps/action.yml b/.github/actions/print-jvm-thread-dumps/action.yml index bab22e54897a..9b0905b77725 100644 --- a/.github/actions/print-jvm-thread-dumps/action.yml +++ b/.github/actions/print-jvm-thread-dumps/action.yml @@ -7,7 +7,7 @@ runs: shell: bash run: | for jvm_pid in $(jps -q -J-XX:+PerfDisableSharedMem); do - jcmd $java_pid Thread.print + jcmd $jvm_pid Thread.print done - if: ${{ runner.os == 'Windows' }} shell: powershell From d80cf0540627f39cebba6c72d5962a36b067971c Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 28 May 2024 10:49:19 +0100 Subject: [PATCH 005/108] Remove unnecessary use of SingletonSupplier As of Framework 6.1, it contains a field of a type that's incompatible with Gradle's configuration cache. Fixes gh-40911 --- .../tasks/buildinfo/BuildInfoProperties.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfoProperties.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfoProperties.java index e75f1a3352e4..cb2d41311013 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfoProperties.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfoProperties.java @@ -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. @@ -36,8 +36,6 @@ import org.gradle.api.tasks.Internal; import org.gradle.api.tasks.Optional; -import org.springframework.util.function.SingletonSupplier; - /** * The properties that are written into the {@code build-info.properties} file. * @@ -49,7 +47,7 @@ public abstract class BuildInfoProperties implements Serializable { private final SetProperty excludes; - private final Supplier creationTime = SingletonSupplier.of(new CurrentIsoInstantSupplier()); + private final Supplier creationTime = () -> DateTimeFormatter.ISO_INSTANT.format(Instant.now()); @Inject public BuildInfoProperties(Project project, SetProperty excludes) { @@ -172,13 +170,4 @@ private Map applyExclusions(Map input) { return output; } - private static final class CurrentIsoInstantSupplier implements Supplier { - - @Override - public String get() { - return DateTimeFormatter.ISO_INSTANT.format(Instant.now()); - } - - } - } From 4bb9197a1441f187096694ea7600fd7713f75b35 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 28 May 2024 10:52:12 +0100 Subject: [PATCH 006/108] Do not update Homebrew tap when publishing 3.2.x releases Closes gh-40921 --- .../actions/update-homebrew-tap/action.yml | 32 ------------------- .github/workflows/release.yml | 15 --------- 2 files changed, 47 deletions(-) delete mode 100644 .github/actions/update-homebrew-tap/action.yml diff --git a/.github/actions/update-homebrew-tap/action.yml b/.github/actions/update-homebrew-tap/action.yml deleted file mode 100644 index 52b20e0990a8..000000000000 --- a/.github/actions/update-homebrew-tap/action.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Update Homebrew Tap -description: Updates the Homebrew Tap for the Spring Boot CLI -inputs: - spring-boot-version: - description: 'The version to publish' - required: true - token: - description: 'Token to use for GitHub authentication' - required: true -runs: - using: composite - steps: - - name: Check Out Homebrew Tap Repo - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - path: updated-homebrew-tap-repo - repository: spring-io/homebrew-tap - token: ${{ inputs.token }} - - name: Update Homebrew Tap - shell: bash - run: | - pushd updated-homebrew-tap-repo > /dev/null - curl https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-cli/${{ inputs.spring-boot-version }}/spring-boot-cli-${{ inputs.spring-boot-version }}-homebrew.rb --output spring-boot-cli-${{ inputs.spring-boot-version }}-homebrew.rb - rm spring-boot.rb - mv spring-boot-cli-*.rb spring-boot.rb - git config user.name "Spring Builds" > /dev/null - git config user.email "spring-builds@users.noreply.github.com" > /dev/null - git add spring-boot.rb > /dev/null - git commit -m "Upgrade to Spring Boot ${{ inputs.spring-boot-version }}" > /dev/null - git push - echo "DONE" - popd > /dev/null diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 620b4f6455e9..9ef67270458b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -108,20 +108,6 @@ jobs: sdkman-consumer-key: ${{ secrets.SDKMAN_CONSUMER_KEY }} sdkman-consumer-token: ${{ secrets.SDKMAN_CONSUMER_TOKEN }} spring-boot-version: ${{ needs.build-and-stage-release.outputs.version }} - update-homebrew-tap: - name: Update Homebrew Tap - needs: - - build-and-stage-release - - sync-to-maven-central - runs-on: ubuntu-latest - steps: - - name: Check Out Code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Update Homebrew Tap - uses: ./.github/actions/update-homebrew-tap - with: - spring-boot-version: ${{ needs.build-and-stage-release.outputs.version }} - token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} create-github-release: name: Create GitHub Release needs: @@ -129,7 +115,6 @@ jobs: - promote-release - publish-gradle-plugin - publish-to-sdkman - - update-homebrew-tap runs-on: ubuntu-latest steps: - name: Check Out Code From 5ee058033926417c4b6ac1c97a64d2da0634fb4a Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 28 May 2024 16:52:00 +0100 Subject: [PATCH 007/108] Upgrade to the latest Framework 6.0.x release Closes gh-40929 --- gradle.properties | 1 + .../spring-boot-buildpack-platform/build.gradle | 2 +- .../spring-boot-tools/spring-boot-gradle-plugin/build.gradle | 2 +- .../spring-boot-tools/spring-boot-loader-tools/build.gradle | 2 +- spring-boot-system-tests/spring-boot-image-tests/build.gradle | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 56caefede548..8168f400a3b4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,6 +14,7 @@ kotlinVersion=1.9.24 mavenVersion=3.9.4 nativeBuildToolsVersion=0.9.28 springFrameworkVersion=6.1.8 +springFramework60xVersion=6.0.21 tomcatVersion=10.1.24 kotlin.stdlib.default.dependency=false diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/build.gradle b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/build.gradle index f3886f7b8471..10e41123cbfa 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/build.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/build.gradle @@ -17,7 +17,7 @@ configurations.all { // Downgrade Spring Framework as Gradle cannot cope with 6.1.0-M1's // multi-version jar files with bytecode in META-INF/versions/21 if (dependency.requested.group.equals("org.springframework")) { - dependency.useVersion("6.0.10") + dependency.useVersion("$springFramework60xVersion") } // We manage the version of commons-compress here rather than // in spring-boot-parent to minimize conflicts with Testcontainers diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle index f1886f61f966..806778dd9537 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle @@ -53,7 +53,7 @@ configurations { // Downgrade Spring Framework as Gradle cannot cope with 6.1.0-M1's // multi-version jar files with bytecode in META-INF/versions/21 if (dependency.requested.group.equals("org.springframework")) { - dependency.useVersion("6.0.10") + dependency.useVersion("$springFramework60xVersion") } // We manage the version of commons-compress here rather than // in spring-boot-parent to minimize conflicts with Testcontainers diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/build.gradle b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/build.gradle index 7c2053406537..1e1bf456000f 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/build.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/build.gradle @@ -27,7 +27,7 @@ configurations { // Downgrade Spring Framework as Gradle cannot cope with 6.1.0-M1's // multi-version jar files with bytecode in META-INF/versions/21 if (dependency.requested.group.equals("org.springframework")) { - dependency.useVersion("6.0.10") + dependency.useVersion("$springFramework60xVersion") } // We manage the version of commons-compress here rather than // in spring-boot-parent to minimize conflicts with Testcontainers diff --git a/spring-boot-system-tests/spring-boot-image-tests/build.gradle b/spring-boot-system-tests/spring-boot-image-tests/build.gradle index e4236f1b82fc..40cd4ee60165 100644 --- a/spring-boot-system-tests/spring-boot-image-tests/build.gradle +++ b/spring-boot-system-tests/spring-boot-image-tests/build.gradle @@ -22,7 +22,7 @@ configurations { // Downgrade Spring Framework as Gradle cannot cope with 6.1.0-M1's // multi-version jar files with bytecode in META-INF/versions/21 if (dependency.requested.group.equals("org.springframework")) { - dependency.useVersion("6.0.10") + dependency.useVersion("$springFramework60xVersion") } } } From 3ae1c111a009b2d788efcd69ab870f07fc43e7a3 Mon Sep 17 00:00:00 2001 From: vsanna Date: Tue, 28 May 2024 13:55:38 +0900 Subject: [PATCH 008/108] Warn in the documentation that spring.profiles.group can only be used in non-profile-specific documents See gh-40918 --- .../src/docs/asciidoc/features/profiles.adoc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/profiles.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/profiles.adoc index b76554a076d9..89837251d1b7 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/profiles.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/profiles.adoc @@ -31,8 +31,8 @@ The name of the default profile is `default` and it can be tuned using the confi default: "none" ---- -`spring.profiles.active` and `spring.profiles.default` can only be used in non-profile specific documents. -This means they cannot be included in <> or <> by `spring.config.activate.on-profile`. +`spring.profiles.active` and `spring.profiles.default` can only be used in non-profile-specific documents. +This means they cannot be included in xref:features/external-config.adoc#features.external-config.files.profile-specific[profile specific files] or xref:features/external-config.adoc#features.external-config.files.activation-properties[documents activated] by `spring.config.activate.on-profile`. For example, the second document configuration is invalid: @@ -75,8 +75,8 @@ For example, when an application with the following properties is run, the commo - "local" ---- -WARNING: Similar to `spring.profiles.active`, `spring.profiles.include` can only be used in non-profile specific documents. -This means it cannot be included in <> or <> by `spring.config.activate.on-profile`. +WARNING: Similar to `spring.profiles.active`, `spring.profiles.include` can only be used in non-profile-specific documents. +This means it cannot be included in xref:features/external-config.adoc#features.external-config.files.profile-specific[profile specific files] or xref:features/external-config.adoc#features.external-config.files.activation-properties[documents activated] by `spring.config.activate.on-profile`. Profile groups, which are described in the <> can also be used to add active profiles if a given profile is active. @@ -104,6 +104,8 @@ For example, we can create a `production` group that consists of our `proddb` an Our application can now be started using `--spring.profiles.active=production` to activate the `production`, `proddb` and `prodmq` profiles in one hit. +WARNING: Similar to `spring.profiles.active` and `spring.profiles.include`, `spring.profiles.group` can only be used in non-profile-specific documents. +This means it cannot be included in xref:features/external-config.adoc#features.external-config.files.profile-specific[profile specific files] or xref:features/external-config.adoc#features.external-config.files.activation-properties[documents activated] by `spring.config.activate.on-profile`. [[features.profiles.programmatically-setting-profiles]] From ab2ba674b653c69f921f967e70c19f035d8b4f87 Mon Sep 17 00:00:00 2001 From: "Khan, C M Abdullah" Date: Fri, 24 May 2024 23:46:59 +0600 Subject: [PATCH 009/108] Fix various minor inconsistencies in the documentation See gh-40900 --- .../src/docs/asciidoc/howto/application.adoc | 4 ++-- .../src/docs/asciidoc/howto/data-access.adoc | 14 +++++++------- .../howto/properties-and-configuration.adoc | 8 ++++---- .../src/docs/asciidoc/howto/spring-mvc.adoc | 4 ++-- .../src/docs/asciidoc/howto/testing.adoc | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/application.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/application.adoc index 946efc45c38d..cb561327a793 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/application.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/application.adoc @@ -41,7 +41,7 @@ When reading the code, remember the following rules of thumb: * Look for classes called `+*AutoConfiguration+` and read their sources. Pay special attention to the `+@Conditional*+` annotations to find out what features they enable and when. - Add `--debug` to the command line or a System property `-Ddebug` to get a log on the console of all the auto-configuration decisions that were made in your app. + Add `--debug` to the command line or the System property `-Ddebug` to get a log on the console of all the auto-configuration decisions that were made in your app. In a running application with actuator enabled, look at the `conditions` endpoint (`/actuator/conditions` or the JMX equivalent) for the same information. * Look for classes that are `@ConfigurationProperties` (such as {spring-boot-autoconfigure-module-code}/web/ServerProperties.java[`ServerProperties`]) and read from there the available external configuration options. The `@ConfigurationProperties` annotation has a `name` attribute that acts as a prefix to external properties. @@ -103,5 +103,5 @@ Not all Spring applications have to be web applications (or web services). If you want to execute some code in a `main` method but also bootstrap a Spring application to set up the infrastructure to use, you can use the `SpringApplication` features of Spring Boot. A `SpringApplication` changes its `ApplicationContext` class, depending on whether it thinks it needs a web application or not. The first thing you can do to help it is to leave server-related dependencies (such as the servlet API) off the classpath. -If you cannot do that (for example, you run two applications from the same code base) then you can explicitly call `setWebApplicationType(WebApplicationType.NONE)` on your `SpringApplication` instance or set the `applicationContextClass` property (through the Java API or with external properties). +If you cannot do that (for example, if you run two applications from the same code base) then you can explicitly call `setWebApplicationType(WebApplicationType.NONE)` on your `SpringApplication` instance or set the `applicationContextClass` property (through the Java API or with external properties). Application code that you want to run as your business logic can be implemented as a `CommandLineRunner` and dropped into the context as a `@Bean` definition. diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/data-access.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/data-access.adoc index 5c5894d83724..ddff627d958a 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/data-access.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/data-access.adoc @@ -15,7 +15,7 @@ The following example shows how to define a data source in a bean: include::code:custom/MyDataSourceConfiguration[] -The following example shows how to define a data source by setting properties: +The following example shows how to define a data source by setting its properties: [source,yaml,indent=0,subs="verbatim",configblocks] ---- @@ -29,7 +29,7 @@ The following example shows how to define a data source by setting properties: Assuming that `SomeDataSource` has regular JavaBean properties for the URL, the username, and the pool size, these settings are bound automatically before the `DataSource` is made available to other components. Spring Boot also provides a utility builder class, called `DataSourceBuilder`, that can be used to create one of the standard data sources (if it is on the classpath). -The builder can detect the one to use based on what is available on the classpath. +The builder can detect which one to use based on what is available on the classpath. It also auto-detects the driver based on the JDBC URL. The following example shows how to create a data source by using a `DataSourceBuilder`: @@ -70,7 +70,7 @@ In that case, you must rewrite your configuration as follows: You can fix that by forcing the connection pool to use and return a dedicated implementation rather than `DataSource`. You cannot change the implementation at runtime, but the list of options will be explicit. -The following example shows how create a `HikariDataSource` with `DataSourceBuilder`: +The following example shows how to create a `HikariDataSource` with `DataSourceBuilder`: include::code:simple/MyDataSourceConfiguration[] @@ -107,7 +107,7 @@ See "`<>`" in the "`Spring Boot features`" section and [[howto.data-access.configure-two-datasources]] === Configure Two DataSources -If you need to configure multiple data sources, you can apply the same tricks that are described in the previous section. +If you need to configure multiple data sources, you can apply the same tricks that were described in the previous section. You must, however, mark one of the `DataSource` instances as `@Primary`, because various auto-configurations down the road expect to be able to get one by type. If you create your own `DataSource`, the auto-configuration backs off. @@ -208,7 +208,7 @@ If you use other forms, such as `batchSize` or `batch-size`, Hibernate will not ==== TIP: If you need to apply advanced customization to Hibernate properties, consider registering a `HibernatePropertiesCustomizer` bean that will be invoked prior to creating the `EntityManagerFactory`. -This takes precedence to anything that is applied by the auto-configuration. +This takes precedence over anything that is applied by the auto-configuration. @@ -286,7 +286,7 @@ It scans entities located in the same package as `Order`. It is possible to map additional JPA properties using the `app.first.jpa` namespace. NOTE: When you create a bean for `LocalContainerEntityManagerFactoryBean` yourself, any customization that was applied during the creation of the auto-configured `LocalContainerEntityManagerFactoryBean` is lost. -For example, in case of Hibernate, any properties under the `spring.jpa.hibernate` prefix will not be automatically applied to your `LocalContainerEntityManagerFactoryBean`. +For example, in the case of Hibernate, any properties under the `spring.jpa.hibernate` prefix will not be automatically applied to your `LocalContainerEntityManagerFactoryBean`. If you were relying on these properties for configuring things like the naming strategy or the DDL mode, you will need to explicitly configure that when creating the `LocalContainerEntityManagerFactoryBean` bean. You should provide a similar configuration for any additional data sources for which you need JPA access. @@ -349,7 +349,7 @@ If you need to specify an order, make sure it is higher than 0. === Configure a Component that is Used by JPA If you want to configure a component that JPA uses, then you need to ensure that the component is initialized before JPA. When the component is auto-configured, Spring Boot takes care of this for you. -For example, when Flyway is auto-configured, Hibernate is configured to depend upon Flyway so that Flyway has a chance to initialize the database before Hibernate tries to use it. +For example, when Flyway is auto-configured, Hibernate is configured to depend on Flyway so that Flyway has a chance to initialize the database before Hibernate tries to use it. If you are configuring a component yourself, you can use an `EntityManagerFactoryDependsOnPostProcessor` subclass as a convenient way of setting up the necessary dependencies. For example, if you use Hibernate Search with Elasticsearch as its index manager, any `EntityManagerFactory` beans must be configured to depend on the `elasticsearchClient` bean, as shown in the following example: diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/properties-and-configuration.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/properties-and-configuration.adoc index 208b3504a2f5..8f327f210511 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/properties-and-configuration.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/properties-and-configuration.adoc @@ -13,7 +13,7 @@ This is possible in both Maven and Gradle. [[howto.properties-and-configuration.expand-properties.maven]] ==== Automatic Property Expansion Using Maven -You can automatically expand properties from the Maven project by using resource filtering. +You can automatically expand properties in the Maven project by using resource filtering. If you use the `spring-boot-starter-parent`, you can then refer to your Maven '`project properties`' with `@..@` placeholders, as shown in the following example: [source,yaml,indent=0,subs="verbatim",configblocks] @@ -126,7 +126,7 @@ Given the examples above, if we have the following configuration: banner-mode: "console" ---- -The actual application will show the banner (as overridden by configuration) and uses three sources for the `ApplicationContext`. +The actual application will show the banner (as overridden by configuration) and use three sources for the `ApplicationContext`. The application sources are: . `MyApplication` (from the code) @@ -146,7 +146,7 @@ You can also provide the following System properties (or environment variables) A separate `Environment` property source is set up for this document and it can be overridden by system properties, environment variables, or the command line. No matter what you set in the environment, Spring Boot always loads `application.properties` as described above. -By default, if YAML is used, then files with the '`.yaml`' and '`.yml`' extension are also added to the list. +By default, if YAML is used, then files with the '`.yaml`' and '`.yml`' extensions are also added to the list. TIP: If you want detailed information about the files that are being loaded you can <> of `org.springframework.boot.context.config` to `trace`. @@ -167,7 +167,7 @@ TIP: If you inherit from the `spring-boot-starter-parent` POM, the default filte If you have enabled Maven filtering for the `application.properties` directly, you may want to also change the default filter token to use https://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#delimiters[other delimiters]. NOTE: In this specific case, the port binding works in a PaaS environment such as Heroku or Cloud Foundry. -In those two platforms, the `PORT` environment variable is set automatically and Spring can bind to capitalized synonyms for `Environment` properties. +On those two platforms, the `PORT` environment variable is set automatically and Spring can bind to capitalized synonyms for `Environment` properties. diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/spring-mvc.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/spring-mvc.adoc index 1a137f05a2a6..2742828a15d6 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/spring-mvc.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/spring-mvc.adoc @@ -135,7 +135,7 @@ It has some useful methods to access the default and user-enhanced message conve As in normal MVC usage, any `WebMvcConfigurer` beans that you provide can also contribute converters by overriding the `configureMessageConverters` method. However, unlike with normal MVC, you can supply only additional converters that you need (because Spring Boot uses the same mechanism to contribute its defaults). -Finally, if you opt out of the Spring Boot default MVC configuration by providing your own `@EnableWebMvc` configuration, you can take control completely and do everything manually by using `getMessageConverters` from `WebMvcConfigurationSupport`. +Finally, if you opt out of the default Spring Boot MVC configuration by providing your own `@EnableWebMvc` configuration, you can take control completely and do everything manually by using `getMessageConverters` from `WebMvcConfigurationSupport`. See the {spring-boot-autoconfigure-module-code}/web/servlet/WebMvcAutoConfiguration.java[`WebMvcAutoConfiguration`] source code for more details. @@ -152,7 +152,7 @@ The multipart support is helpful when you want to receive multipart encoded file See the {spring-boot-autoconfigure-module-code}/web/servlet/MultipartAutoConfiguration.java[`MultipartAutoConfiguration`] source for more details. -NOTE: It is recommended to use the container's built-in support for multipart uploads rather than introducing an additional dependency such as Apache Commons File Upload. +NOTE: It is recommended to use the container's built-in support for multipart uploads rather than introduce an additional dependency such as Apache Commons File Upload. diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/testing.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/testing.adoc index f0a1a1f92327..53fc7dd28c5c 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/testing.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/howto/testing.adoc @@ -46,6 +46,6 @@ include::{docs-java}/howto/testing/slicetests/MySecurityConfiguration.java[] include::{docs-java}/howto/testing/slicetests/MyDatasourceConfiguration.java[] ---- -Having a single configuration class can be inefficient when beans of a certain domain need to be included in slice tests. +Having a single configuration class can be inefficient when beans from a certain domain need to be included in slice tests. Instead, structuring the application's configuration as multiple granular classes with beans for a specific domain can enable importing them only for specific slice tests. From 2e1ad6bdcc25445cd8b928ebe8a902cc10597d45 Mon Sep 17 00:00:00 2001 From: erie0210 <2j00923@gmail.com> Date: Sun, 26 May 2024 16:59:46 +0900 Subject: [PATCH 010/108] Add Kotlin example for @Testcontainers See gh-40905 --- .../dynamicproperties/MyIntegrationTests.kt | 47 +++++++++++++++++++ .../serviceconnections/MyIntegrationTests.kt | 42 +++++++++++++++++ .../MyRedisConfiguration.kt | 31 ++++++++++++ .../vanilla/MyIntegrationTests.kt | 42 +++++++++++++++++ 4 files changed, 162 insertions(+) create mode 100644 spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/dynamicproperties/MyIntegrationTests.kt create mode 100644 spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/serviceconnections/MyIntegrationTests.kt create mode 100644 spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/serviceconnections/MyRedisConfiguration.kt create mode 100644 spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/vanilla/MyIntegrationTests.kt diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/dynamicproperties/MyIntegrationTests.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/dynamicproperties/MyIntegrationTests.kt new file mode 100644 index 000000000000..c2aa497a5702 --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/dynamicproperties/MyIntegrationTests.kt @@ -0,0 +1,47 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.docs.testing.testcontainers.dynamicproperties; + +import org.junit.jupiter.api.Test +import org.springframework.boot.test.context.SpringBootTest +import org.springframework.test.context.DynamicPropertyRegistry +import org.springframework.test.context.DynamicPropertySource +import org.testcontainers.containers.Neo4jContainer +import org.testcontainers.junit.jupiter.Container +import org.testcontainers.junit.jupiter.Testcontainers + +@Testcontainers +@SpringBootTest +class MyIntegrationTests { + + @Test + fun myTest() { + // ... + } + + companion object { + @Container + @JvmStatic + val neo4j = Neo4jContainer("neo4j:5"); + + @DynamicPropertySource + @JvmStatic + fun neo4jProperties(registry: DynamicPropertyRegistry) { + registry.add("spring.neo4j.uri") { neo4j.boltUrl } + } + } +} diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/serviceconnections/MyIntegrationTests.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/serviceconnections/MyIntegrationTests.kt new file mode 100644 index 000000000000..6f84114eb201 --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/serviceconnections/MyIntegrationTests.kt @@ -0,0 +1,42 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.docs.testing.testcontainers.serviceconnections; + +import org.junit.jupiter.api.Test; +import org.testcontainers.containers.Neo4jContainer; +import org.testcontainers.junit.jupiter.Container; +import org.testcontainers.junit.jupiter.Testcontainers; + +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.testcontainers.service.connection.ServiceConnection; + +@Testcontainers +@SpringBootTest +class MyIntegrationTests { + + @Test + fun myTest() { + // ... + } + + companion object { + @Container + @ServiceConnection + @JvmStatic + val neo4j = Neo4jContainer("neo4j:5"); + } +} diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/serviceconnections/MyRedisConfiguration.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/serviceconnections/MyRedisConfiguration.kt new file mode 100644 index 000000000000..fb5ac0340673 --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/serviceconnections/MyRedisConfiguration.kt @@ -0,0 +1,31 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.docs.testing.testcontainers.serviceconnections; + +import org.springframework.boot.test.context.TestConfiguration +import org.springframework.boot.testcontainers.service.connection.ServiceConnection +import org.springframework.context.annotation.Bean +import org.testcontainers.containers.GenericContainer + +@TestConfiguration(proxyBeanMethods = false) +class MyRedisConfiguration { + @Bean + @ServiceConnection(name = "redis") + fun redisContainer(): GenericContainer<*> { + return GenericContainer("redis:7") + } +} \ No newline at end of file diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/vanilla/MyIntegrationTests.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/vanilla/MyIntegrationTests.kt new file mode 100644 index 000000000000..587ed84cce62 --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/vanilla/MyIntegrationTests.kt @@ -0,0 +1,42 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.docs.testing.testcontainers.vanilla; + +import org.junit.jupiter.api.Test; +import org.testcontainers.containers.Neo4jContainer; +import org.testcontainers.junit.jupiter.Container; +import org.testcontainers.junit.jupiter.Testcontainers; + +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.testcontainers.service.connection.ServiceConnection + +@Testcontainers +@SpringBootTest +class MyIntegrationTests { + + @Test + fun myTest() { + // ... + } + + companion object { + @Container + @JvmStatic + val neo4j = Neo4jContainer("neo4j:5"); + } +} + From 345edb13013095f104cbdf2fee4c6bc3e7dd4933 Mon Sep 17 00:00:00 2001 From: Maziz Date: Sun, 19 May 2024 13:05:55 +0800 Subject: [PATCH 011/108] Fix Flyway 10 in a GraalVM native image See gh-40821 --- ...NativeImageResourceProviderCustomizer.java | 47 +++++++++++++++-- ...eImageResourceProviderCustomizerTests.java | 52 +++++++++++++++++++ 2 files changed, 95 insertions(+), 4 deletions(-) create mode 100644 spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/Flyway10NativeImageResourceProviderCustomizerTests.java diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProviderCustomizer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProviderCustomizer.java index 1dd7b6e55ecb..4e7668379eba 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProviderCustomizer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProviderCustomizer.java @@ -16,6 +16,8 @@ package org.springframework.boot.autoconfigure.flyway; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import java.util.Arrays; import org.flywaydb.core.api.configuration.FluentConfiguration; @@ -24,21 +26,21 @@ import org.flywaydb.core.internal.scanner.ResourceNameCache; import org.flywaydb.core.internal.scanner.Scanner; +import org.springframework.util.ClassUtils; + /** * Registers {@link NativeImageResourceProvider} as a Flyway * {@link org.flywaydb.core.api.ResourceProvider}. * * @author Moritz Halbritter + * @author Maziz Esa */ class NativeImageResourceProviderCustomizer extends ResourceProviderCustomizer { @Override public void customize(FluentConfiguration configuration) { if (configuration.getResourceProvider() == null) { - Scanner scanner = new Scanner<>(JavaMigration.class, - Arrays.asList(configuration.getLocations()), configuration.getClassLoader(), - configuration.getEncoding(), configuration.isDetectEncoding(), false, new ResourceNameCache(), - new LocationScannerCache(), configuration.isFailOnMissingLocations()); + final var scanner = getFlyway9OrFallbackTo10ScannerObject(configuration); NativeImageResourceProvider resourceProvider = new NativeImageResourceProvider(scanner, configuration.getClassLoader(), Arrays.asList(configuration.getLocations()), configuration.getEncoding(), configuration.isFailOnMissingLocations()); @@ -46,4 +48,41 @@ public void customize(FluentConfiguration configuration) { } } + private static Scanner getFlyway9OrFallbackTo10ScannerObject(FluentConfiguration configuration) { + Scanner scanner; + try { + scanner = getFlyway9Scanner(configuration); + } + catch (NoSuchMethodError noSuchMethodError) { + // happens when scanner is flyway version 10, which the constructor accepts + // different number of parameters. + scanner = getFlyway10Scanner(configuration); + } + return scanner; + } + + private static Scanner getFlyway10Scanner(FluentConfiguration configuration) { + final Constructor scannerConstructor; + final Scanner scanner; + try { + scannerConstructor = ClassUtils.forName("org.flywaydb.core.internal.scanner.Scanner", null) + .getDeclaredConstructors()[0]; + scanner = (Scanner) scannerConstructor.newInstance(JavaMigration.class, false, new ResourceNameCache(), + new LocationScannerCache(), configuration); + } + catch (ClassNotFoundException | InstantiationException | IllegalAccessException + | InvocationTargetException ex) { + throw new RuntimeException(ex); + } + return scanner; + } + + private static Scanner getFlyway9Scanner(FluentConfiguration configuration) { + Scanner scanner; + scanner = new Scanner<>(JavaMigration.class, Arrays.asList(configuration.getLocations()), + configuration.getClassLoader(), configuration.getEncoding(), configuration.isDetectEncoding(), false, + new ResourceNameCache(), new LocationScannerCache(), configuration.isFailOnMissingLocations()); + return scanner; + } + } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/Flyway10NativeImageResourceProviderCustomizerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/Flyway10NativeImageResourceProviderCustomizerTests.java new file mode 100644 index 000000000000..9e3e5e4db3b8 --- /dev/null +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/Flyway10NativeImageResourceProviderCustomizerTests.java @@ -0,0 +1,52 @@ +/* + * Copyright 2012-2023 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.autoconfigure.flyway; + +import java.util.Collection; + +import org.flywaydb.core.api.ResourceProvider; +import org.flywaydb.core.api.configuration.FluentConfiguration; +import org.flywaydb.core.api.resource.LoadableResource; +import org.junit.jupiter.api.Test; + +import org.springframework.boot.testsupport.classpath.ClassPathOverrides; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * Tests for {@link NativeImageResourceProviderCustomizer} with Flyway 10. + * + * @author Moritz Halbritter + * @author Andy Wilkinson + * @author Maziz + */ +@ClassPathOverrides("org.flywaydb:flyway-core:10.12.0") +class Flyway10NativeImageResourceProviderCustomizerTests { + + private final NativeImageResourceProviderCustomizer customizer = new NativeImageResourceProviderCustomizer(); + + @Test + void nativeImageResourceProviderShouldFindMigrations() { + FluentConfiguration configuration = new FluentConfiguration(); + this.customizer.customize(configuration); + ResourceProvider resourceProvider = configuration.getResourceProvider(); + Collection migrations = resourceProvider.getResources("V", new String[] { ".sql" }); + LoadableResource migration = resourceProvider.getResource("V1__init.sql"); + assertThat(migrations).containsExactly(migration); + } + +} From 10e23b8f35520bac6aa83b4a3225257d46b75427 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 29 May 2024 14:17:50 +0100 Subject: [PATCH 012/108] Polish "Fix Flyway 10 in a GraalVM native image" See gh-40821 --- .../flyway/FlywayAutoConfiguration.java | 8 +++- ...NativeImageResourceProviderCustomizer.java | 46 +++++++------------ ...ImageResourceProviderCustomizerTests.java} | 6 +-- 3 files changed, 26 insertions(+), 34 deletions(-) rename spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/{Flyway10NativeImageResourceProviderCustomizerTests.java => Flyway10xNativeImageResourceProviderCustomizerTests.java} (92%) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java index a7e93b42157c..af714f241d28 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java @@ -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. @@ -36,9 +36,11 @@ import org.flywaydb.core.api.migration.JavaMigration; import org.flywaydb.core.extensibility.ConfigurationExtension; import org.flywaydb.core.internal.database.postgresql.PostgreSQLConfigurationExtension; +import org.flywaydb.core.internal.scanner.Scanner; import org.flywaydb.database.oracle.OracleConfigurationExtension; import org.flywaydb.database.sqlserver.SQLServerConfigurationExtension; +import org.springframework.aot.hint.MemberCategory; import org.springframework.aot.hint.RuntimeHints; import org.springframework.aot.hint.RuntimeHintsRegistrar; import org.springframework.beans.factory.ObjectProvider; @@ -78,6 +80,7 @@ import org.springframework.jdbc.support.JdbcUtils; import org.springframework.jdbc.support.MetaDataAccessException; import org.springframework.util.Assert; +import org.springframework.util.ClassUtils; import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; @@ -461,6 +464,9 @@ static class FlywayAutoConfigurationRuntimeHints implements RuntimeHintsRegistra @Override public void registerHints(RuntimeHints hints, ClassLoader classLoader) { hints.resources().registerPattern("db/migration/*"); + if (ClassUtils.isPresent("org.flywaydb.core.extensibility.Tier", classLoader)) { + hints.reflection().registerType(Scanner.class, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS); + } } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProviderCustomizer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProviderCustomizer.java index 4e7668379eba..3abbee4bf94a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProviderCustomizer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProviderCustomizer.java @@ -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. @@ -17,17 +17,15 @@ package org.springframework.boot.autoconfigure.flyway; import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; import java.util.Arrays; +import org.flywaydb.core.api.configuration.Configuration; import org.flywaydb.core.api.configuration.FluentConfiguration; import org.flywaydb.core.api.migration.JavaMigration; import org.flywaydb.core.internal.scanner.LocationScannerCache; import org.flywaydb.core.internal.scanner.ResourceNameCache; import org.flywaydb.core.internal.scanner.Scanner; -import org.springframework.util.ClassUtils; - /** * Registers {@link NativeImageResourceProvider} as a Flyway * {@link org.flywaydb.core.api.ResourceProvider}. @@ -40,7 +38,7 @@ class NativeImageResourceProviderCustomizer extends ResourceProviderCustomizer { @Override public void customize(FluentConfiguration configuration) { if (configuration.getResourceProvider() == null) { - final var scanner = getFlyway9OrFallbackTo10ScannerObject(configuration); + Scanner scanner = createScanner(configuration); NativeImageResourceProvider resourceProvider = new NativeImageResourceProvider(scanner, configuration.getClassLoader(), Arrays.asList(configuration.getLocations()), configuration.getEncoding(), configuration.isFailOnMissingLocations()); @@ -48,41 +46,29 @@ public void customize(FluentConfiguration configuration) { } } - private static Scanner getFlyway9OrFallbackTo10ScannerObject(FluentConfiguration configuration) { - Scanner scanner; + private static Scanner createScanner(FluentConfiguration configuration) { try { - scanner = getFlyway9Scanner(configuration); + return new Scanner<>(JavaMigration.class, Arrays.asList(configuration.getLocations()), + configuration.getClassLoader(), configuration.getEncoding(), configuration.isDetectEncoding(), + false, new ResourceNameCache(), new LocationScannerCache(), + configuration.isFailOnMissingLocations()); } - catch (NoSuchMethodError noSuchMethodError) { - // happens when scanner is flyway version 10, which the constructor accepts - // different number of parameters. - scanner = getFlyway10Scanner(configuration); + catch (NoSuchMethodError ex) { + // Flyway 10 + return createFlyway10Scanner(configuration); } - return scanner; } - private static Scanner getFlyway10Scanner(FluentConfiguration configuration) { - final Constructor scannerConstructor; - final Scanner scanner; + private static Scanner createFlyway10Scanner(FluentConfiguration configuration) throws LinkageError { try { - scannerConstructor = ClassUtils.forName("org.flywaydb.core.internal.scanner.Scanner", null) - .getDeclaredConstructors()[0]; - scanner = (Scanner) scannerConstructor.newInstance(JavaMigration.class, false, new ResourceNameCache(), + Constructor scannerConstructor = Scanner.class.getDeclaredConstructor(Class.class, boolean.class, + ResourceNameCache.class, LocationScannerCache.class, Configuration.class); + return (Scanner) scannerConstructor.newInstance(JavaMigration.class, false, new ResourceNameCache(), new LocationScannerCache(), configuration); } - catch (ClassNotFoundException | InstantiationException | IllegalAccessException - | InvocationTargetException ex) { + catch (Exception ex) { throw new RuntimeException(ex); } - return scanner; - } - - private static Scanner getFlyway9Scanner(FluentConfiguration configuration) { - Scanner scanner; - scanner = new Scanner<>(JavaMigration.class, Arrays.asList(configuration.getLocations()), - configuration.getClassLoader(), configuration.getEncoding(), configuration.isDetectEncoding(), false, - new ResourceNameCache(), new LocationScannerCache(), configuration.isFailOnMissingLocations()); - return scanner; } } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/Flyway10NativeImageResourceProviderCustomizerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/Flyway10xNativeImageResourceProviderCustomizerTests.java similarity index 92% rename from spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/Flyway10NativeImageResourceProviderCustomizerTests.java rename to spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/Flyway10xNativeImageResourceProviderCustomizerTests.java index 9e3e5e4db3b8..29d60254b65e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/Flyway10NativeImageResourceProviderCustomizerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/Flyway10xNativeImageResourceProviderCustomizerTests.java @@ -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. @@ -32,10 +32,10 @@ * * @author Moritz Halbritter * @author Andy Wilkinson - * @author Maziz + * @author Maziz Esa */ @ClassPathOverrides("org.flywaydb:flyway-core:10.12.0") -class Flyway10NativeImageResourceProviderCustomizerTests { +class Flyway10xNativeImageResourceProviderCustomizerTests { private final NativeImageResourceProviderCustomizer customizer = new NativeImageResourceProviderCustomizer(); From 211bf95f451f456af433c9b0c67d3064a731309b Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 30 May 2024 08:00:11 +0100 Subject: [PATCH 013/108] Revert "Adapt to Spring Data Neo4j now requiring a transaction manager" This reverts commit b6467ed826818db5d18061496768db3f6758c916. Changes in Spring Data Neo4j mean that these changes are no longer necessary. They also caused a problem with multiple transaction managers being present when mixing Neo4j and, say, Data JPA. Closes gh-40895 --- .../neo4j/Neo4jDataAutoConfiguration.java | 30 ++++++++++- .../Neo4jReactiveDataAutoConfiguration.java | 10 +--- .../Neo4jRepositoriesAutoConfiguration.java | 3 -- .../Neo4jTransactionManagerConfiguration.java | 48 ----------------- ...jTransactionalComponentsConfiguration.java | 54 ------------------- 5 files changed, 29 insertions(+), 116 deletions(-) delete mode 100644 spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jTransactionManagerConfiguration.java delete mode 100644 spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jTransactionalComponentsConfiguration.java diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfiguration.java index 3894d95c345a..122b36372868 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfiguration.java @@ -20,6 +20,7 @@ import org.neo4j.driver.Driver; +import org.springframework.beans.factory.ObjectProvider; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; @@ -29,18 +30,23 @@ import org.springframework.boot.autoconfigure.neo4j.Neo4jAutoConfiguration; import org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration; import org.springframework.boot.autoconfigure.transaction.TransactionManagerCustomizationAutoConfiguration; +import org.springframework.boot.autoconfigure.transaction.TransactionManagerCustomizers; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Import; import org.springframework.data.neo4j.aot.Neo4jManagedTypes; import org.springframework.data.neo4j.core.DatabaseSelectionProvider; +import org.springframework.data.neo4j.core.Neo4jClient; +import org.springframework.data.neo4j.core.Neo4jOperations; +import org.springframework.data.neo4j.core.Neo4jTemplate; import org.springframework.data.neo4j.core.convert.Neo4jConversions; import org.springframework.data.neo4j.core.mapping.Neo4jMappingContext; import org.springframework.data.neo4j.core.schema.Node; import org.springframework.data.neo4j.core.schema.RelationshipProperties; import org.springframework.data.neo4j.core.transaction.Neo4jTransactionManager; +import org.springframework.data.neo4j.repository.config.Neo4jRepositoryConfigurationExtension; import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.TransactionManager; /** * {@link EnableAutoConfiguration Auto-configuration} for Spring Data Neo4j. @@ -58,7 +64,6 @@ @ConditionalOnClass({ Driver.class, Neo4jTransactionManager.class, PlatformTransactionManager.class }) @EnableConfigurationProperties(Neo4jDataProperties.class) @ConditionalOnBean(Driver.class) -@Import({ Neo4jTransactionManagerConfiguration.class, Neo4jTransactionalComponentsConfiguration.class }) public class Neo4jDataAutoConfiguration { @Bean @@ -91,4 +96,25 @@ public DatabaseSelectionProvider databaseSelectionProvider(Neo4jDataProperties p : DatabaseSelectionProvider.getDefaultSelectionProvider(); } + @Bean(Neo4jRepositoryConfigurationExtension.DEFAULT_NEO4J_CLIENT_BEAN_NAME) + @ConditionalOnMissingBean + public Neo4jClient neo4jClient(Driver driver, DatabaseSelectionProvider databaseNameProvider) { + return Neo4jClient.create(driver, databaseNameProvider); + } + + @Bean(Neo4jRepositoryConfigurationExtension.DEFAULT_NEO4J_TEMPLATE_BEAN_NAME) + @ConditionalOnMissingBean(Neo4jOperations.class) + public Neo4jTemplate neo4jTemplate(Neo4jClient neo4jClient, Neo4jMappingContext neo4jMappingContext) { + return new Neo4jTemplate(neo4jClient, neo4jMappingContext); + } + + @Bean(Neo4jRepositoryConfigurationExtension.DEFAULT_TRANSACTION_MANAGER_BEAN_NAME) + @ConditionalOnMissingBean(TransactionManager.class) + public Neo4jTransactionManager transactionManager(Driver driver, DatabaseSelectionProvider databaseNameProvider, + ObjectProvider optionalCustomizers) { + Neo4jTransactionManager transactionManager = new Neo4jTransactionManager(driver, databaseNameProvider); + optionalCustomizers.ifAvailable((customizer) -> customizer.customize((TransactionManager) transactionManager)); + return transactionManager; + } + } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jReactiveDataAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jReactiveDataAutoConfiguration.java index b3c4752c0faf..94fa7836d314 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jReactiveDataAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jReactiveDataAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 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. @@ -30,7 +30,6 @@ import org.springframework.data.neo4j.core.ReactiveNeo4jOperations; import org.springframework.data.neo4j.core.ReactiveNeo4jTemplate; import org.springframework.data.neo4j.core.mapping.Neo4jMappingContext; -import org.springframework.data.neo4j.core.transaction.ReactiveNeo4jTransactionManager; import org.springframework.data.neo4j.repository.config.ReactiveNeo4jRepositoryConfigurationExtension; import org.springframework.transaction.ReactiveTransactionManager; @@ -69,11 +68,4 @@ public ReactiveNeo4jTemplate reactiveNeo4jTemplate(ReactiveNeo4jClient neo4jClie return new ReactiveNeo4jTemplate(neo4jClient, neo4jMappingContext); } - @Bean(ReactiveNeo4jRepositoryConfigurationExtension.DEFAULT_TRANSACTION_MANAGER_BEAN_NAME) - @ConditionalOnMissingBean(ReactiveTransactionManager.class) - ReactiveNeo4jTransactionManager rectiveNeo4jTransactionManager(Driver driver, - ReactiveDatabaseSelectionProvider databaseNameProvider) { - return new ReactiveNeo4jTransactionManager(driver, databaseNameProvider); - } - } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jRepositoriesAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jRepositoriesAutoConfiguration.java index b4ebda404436..76d2ae2a3cf2 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jRepositoriesAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jRepositoriesAutoConfiguration.java @@ -20,13 +20,11 @@ import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.data.ConditionalOnRepositoryType; import org.springframework.boot.autoconfigure.data.RepositoryType; import org.springframework.context.annotation.Import; -import org.springframework.data.neo4j.core.Neo4jTemplate; import org.springframework.data.neo4j.repository.Neo4jRepository; import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories; import org.springframework.data.neo4j.repository.config.Neo4jRepositoryConfigurationExtension; @@ -54,7 +52,6 @@ @AutoConfiguration(after = Neo4jDataAutoConfiguration.class) @ConditionalOnClass({ Driver.class, Neo4jRepository.class }) @ConditionalOnMissingBean({ Neo4jRepositoryFactoryBean.class, Neo4jRepositoryConfigurationExtension.class }) -@ConditionalOnBean(Neo4jTemplate.class) @ConditionalOnRepositoryType(store = "neo4j", type = RepositoryType.IMPERATIVE) @Import(Neo4jRepositoriesRegistrar.class) public class Neo4jRepositoriesAutoConfiguration { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jTransactionManagerConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jTransactionManagerConfiguration.java deleted file mode 100644 index 53fb41d9954c..000000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jTransactionManagerConfiguration.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.autoconfigure.data.neo4j; - -import org.neo4j.driver.Driver; - -import org.springframework.beans.factory.ObjectProvider; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.autoconfigure.transaction.TransactionManagerCustomizers; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.data.neo4j.core.DatabaseSelectionProvider; -import org.springframework.data.neo4j.core.transaction.Neo4jTransactionManager; -import org.springframework.data.neo4j.repository.config.Neo4jRepositoryConfigurationExtension; -import org.springframework.transaction.TransactionManager; - -/** - * Configuration for a Neo4j-backed {@link TransactionManager}. - * - * @author Andy Wilkinson - */ -@Configuration(proxyBeanMethods = false) -class Neo4jTransactionManagerConfiguration { - - @Bean(Neo4jRepositoryConfigurationExtension.DEFAULT_TRANSACTION_MANAGER_BEAN_NAME) - @ConditionalOnMissingBean(TransactionManager.class) - Neo4jTransactionManager transactionManager(Driver driver, DatabaseSelectionProvider databaseNameProvider, - ObjectProvider optionalCustomizers) { - Neo4jTransactionManager transactionManager = new Neo4jTransactionManager(driver, databaseNameProvider); - optionalCustomizers.ifAvailable((customizer) -> customizer.customize((TransactionManager) transactionManager)); - return transactionManager; - } - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jTransactionalComponentsConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jTransactionalComponentsConfiguration.java deleted file mode 100644 index d225e3cdbef3..000000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jTransactionalComponentsConfiguration.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.autoconfigure.data.neo4j; - -import org.neo4j.driver.Driver; - -import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.data.neo4j.core.DatabaseSelectionProvider; -import org.springframework.data.neo4j.core.Neo4jClient; -import org.springframework.data.neo4j.core.Neo4jOperations; -import org.springframework.data.neo4j.core.Neo4jTemplate; -import org.springframework.data.neo4j.core.mapping.Neo4jMappingContext; -import org.springframework.data.neo4j.repository.config.Neo4jRepositoryConfigurationExtension; -import org.springframework.transaction.PlatformTransactionManager; - -/** - * Neo4j components that require a {@link PlatformTransactionManager}. - * - * @author Andy Wilkinson - */ -@Configuration(proxyBeanMethods = false) -@ConditionalOnBean(PlatformTransactionManager.class) -class Neo4jTransactionalComponentsConfiguration { - - @Bean(Neo4jRepositoryConfigurationExtension.DEFAULT_NEO4J_CLIENT_BEAN_NAME) - @ConditionalOnMissingBean - Neo4jClient neo4jClient(Driver driver, DatabaseSelectionProvider databaseNameProvider) { - return Neo4jClient.create(driver, databaseNameProvider); - } - - @Bean(Neo4jRepositoryConfigurationExtension.DEFAULT_NEO4J_TEMPLATE_BEAN_NAME) - @ConditionalOnMissingBean(Neo4jOperations.class) - Neo4jTemplate neo4jTemplate(Neo4jClient neo4jClient, Neo4jMappingContext neo4jMappingContext) { - return new Neo4jTemplate(neo4jClient, neo4jMappingContext); - } - -} From 6c5ae329f3a340cec834e054a4dff0ef041fb7d9 Mon Sep 17 00:00:00 2001 From: Mateus Scheper Date: Wed, 29 May 2024 22:59:00 -0300 Subject: [PATCH 014/108] Fix typo in Dev Services reference docs See gh-40951 --- .../src/docs/asciidoc/features/testcontainers.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/testcontainers.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/testcontainers.adoc index 826db3cb7e31..683d7b656d40 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/testcontainers.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/testcontainers.adoc @@ -71,7 +71,7 @@ For example, the following `MyContainers` interface declares `mongo` and `neo4j` include::code:MyContainers[] -If you already have containers defined in this way, or you just prefer this style, you can import these declaration classes rather than defining you containers as `@Bean` methods. +If you already have containers defined in this way, or you just prefer this style, you can import these declaration classes rather than defining your containers as `@Bean` methods. To do so, add the `@ImportTestcontainers` annotation to your test configuration class: include::code:MyContainersConfiguration[] From f000af6a1293690d41e7edf377e83b84803260d3 Mon Sep 17 00:00:00 2001 From: Ahmed Ashour Date: Thu, 30 May 2024 13:19:03 +0200 Subject: [PATCH 015/108] Remove unused parameter and polish javadoc See gh-40955 --- .../autoconfigure/liquibase/LiquibaseAutoConfiguration.java | 3 +-- .../properties/source/ConfigurationPropertyName.java | 6 +++--- .../springframework/boot/web/servlet/server/Encoding.java | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java index 979053511255..94acf9e70c16 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java @@ -89,8 +89,7 @@ public static class LiquibaseConfiguration { @Bean @ConditionalOnMissingBean(LiquibaseConnectionDetails.class) - PropertiesLiquibaseConnectionDetails liquibaseConnectionDetails(LiquibaseProperties properties, - ObjectProvider jdbcConnectionDetails) { + PropertiesLiquibaseConnectionDetails liquibaseConnectionDetails(LiquibaseProperties properties) { return new PropertiesLiquibaseConnectionDetails(properties); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java index 027f1b384b8b..1b6c930b50c0 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java @@ -28,9 +28,9 @@ /** * A configuration property name composed of elements separated by dots. User created - * names may contain the characters "{@code a-z}" "{@code 0-9}") and "{@code -}", they - * must be lower-case and must start with an alphanumeric character. The "{@code -}" is - * used purely for formatting, i.e. "{@code foo-bar}" and "{@code foobar}" are considered + * names may contain the characters "{@code a-z}" "{@code 0-9}" and "{@code -}", they must + * be lower-case and must start with an alphanumeric character. The "{@code -}" is used + * purely for formatting, i.e. "{@code foo-bar}" and "{@code foobar}" are considered * equivalent. *

* The "{@code [}" and "{@code ]}" characters may be used to indicate an associative diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/Encoding.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/Encoding.java index f6a09d36f483..c8b842ebc072 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/Encoding.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/Encoding.java @@ -60,7 +60,7 @@ public class Encoding { private Boolean forceResponse; /** - * Mapping of locale to charset for response encoding.. + * Mapping of locale to charset for response encoding. */ private Map mapping; From dd6f516d66d5833f264e7fa3f84de0b38b205de1 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 29 Apr 2024 17:33:21 +0100 Subject: [PATCH 016/108] Test Gradle Plugin against 8.8 Closes gh-40573 --- .../configure-bom-with-plugins.gradle.kts | 2 +- .../gradle/managing-dependencies/configure-bom.gradle | 2 +- .../gradle/managing-dependencies/configure-bom.gradle.kts | 2 +- .../managing-dependencies/configure-platform.gradle | 2 +- .../managing-dependencies/configure-platform.gradle.kts | 2 +- .../custom-version-with-platform.gradle | 2 +- .../custom-version-with-platform.gradle.kts | 2 +- .../gradle/managing-dependencies/custom-version.gradle | 2 +- .../managing-dependencies/custom-version.gradle.kts | 2 +- .../bundling/AbstractBootArchiveIntegrationTests.java | 8 ++++++-- .../boot/testsupport/gradle/testkit/GradleVersions.java | 4 ++-- 11 files changed, 17 insertions(+), 13 deletions(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/configure-bom-with-plugins.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/configure-bom-with-plugins.gradle.kts index 9f22625463d4..5a6553150763 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/configure-bom-with-plugins.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/configure-bom-with-plugins.gradle.kts @@ -26,6 +26,6 @@ the().apply { repositories { maven { - url = uri("file:repository") + url = uri("repository") } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/configure-bom.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/configure-bom.gradle index 2c11b81900b1..06de18146bb2 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/configure-bom.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/configure-bom.gradle @@ -24,5 +24,5 @@ dependencyManagement { } repositories { - maven { url 'file:repository' } + maven { url 'repository' } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/configure-bom.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/configure-bom.gradle.kts index 43dd49deed86..7eb5f2206956 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/configure-bom.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/configure-bom.gradle.kts @@ -27,6 +27,6 @@ the().apply { repositories { maven { - url = uri("file:repository") + url = uri("repository") } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/configure-platform.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/configure-platform.gradle index 25a265efe187..0cb4a011f92b 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/configure-platform.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/configure-platform.gradle @@ -14,7 +14,7 @@ dependencies { } repositories { - maven { url 'file:repository' } + maven { url 'repository' } } configurations.all { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/configure-platform.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/configure-platform.gradle.kts index 30cfc8ab044b..3a94dc8adbd1 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/configure-platform.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/configure-platform.gradle.kts @@ -15,7 +15,7 @@ dependencies { repositories { maven { - url = uri("file:repository") + url = uri("repository") } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/custom-version-with-platform.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/custom-version-with-platform.gradle index d877c3df16df..bcd590932dd2 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/custom-version-with-platform.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/custom-version-with-platform.gradle @@ -9,7 +9,7 @@ dependencies { } repositories { - maven { url 'file:repository' } + maven { url 'repository' } } configurations.all { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/custom-version-with-platform.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/custom-version-with-platform.gradle.kts index a0262204e945..69af1f2f2888 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/custom-version-with-platform.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/custom-version-with-platform.gradle.kts @@ -10,7 +10,7 @@ dependencies { repositories { maven { - url = uri("file:repository") + url = uri("repository") } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/custom-version.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/custom-version.gradle index ab3d25436f4f..6c512f68dfe0 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/custom-version.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/custom-version.gradle @@ -19,7 +19,7 @@ ext['slf4j.version'] = '1.7.20' // end::custom-version[] repositories { - maven { url 'file:repository' } + maven { url 'repository' } } task slf4jVersion { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/custom-version.gradle.kts b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/custom-version.gradle.kts index a8359facf42d..1886a90dbd9d 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/custom-version.gradle.kts +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/managing-dependencies/custom-version.gradle.kts @@ -12,7 +12,7 @@ extra["slf4j.version"] = "1.7.20" repositories { maven { - url = uri("file:repository") + url = uri("repository") } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java index 4019ffbf6aff..c70207eddbc2 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveIntegrationTests.java @@ -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. @@ -596,7 +596,11 @@ void defaultDirAndFileModesAreUsed() throws IOException { @TestTemplate void dirModeAndFileModeAreApplied() throws IOException { - BuildResult result = this.gradleBuild.build(this.taskName); + BuildResult result = this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("8.8-rc-1") + .expectDeprecationMessages("The CopyProcessingSpec.setDirMode(Integer) method has been deprecated", + "The CopyProcessingSpec.setFileMode(Integer) method has been deprecated", + "upgrading_version_8.html#unix_file_permissions_deprecated") + .build(this.taskName); assertThat(result.task(":" + this.taskName).getOutcome()).isEqualTo(TaskOutcome.SUCCESS); try (ZipFile jarFile = new ZipFile(new File(this.gradleBuild.getProjectDir(), "build/libs").listFiles()[0])) { Enumeration entries = jarFile.getEntries(); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleVersions.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleVersions.java index a82c53ccef09..85d15de32d40 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleVersions.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleVersions.java @@ -35,9 +35,9 @@ private GradleVersions() { @SuppressWarnings("UnstableApiUsage") public static List allCompatible() { if (isJavaVersion(JavaVersion.VERSION_20)) { - return Arrays.asList("8.1.1", "8.7"); + return Arrays.asList("8.1.1", "8.8"); } - return Arrays.asList("7.5.1", GradleVersion.current().getVersion(), "8.0.2", "8.7"); + return Arrays.asList("7.5.1", GradleVersion.current().getVersion(), "8.0.2", "8.8"); } public static String minimumCompatible() { From 570522d876927acb87c8c3bf30d4b742a70641d9 Mon Sep 17 00:00:00 2001 From: "Khan, C M Abdullah" Date: Sat, 1 Jun 2024 01:01:35 +0600 Subject: [PATCH 017/108] Fix typos in method names and javadoc See gh-40971 --- .../boot/actuate/endpoint/SanitizableData.java | 2 +- .../endpoint/annotation/DiscoveredOperationMethod.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SanitizableData.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SanitizableData.java index df399bae449d..2dfa70c06335 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SanitizableData.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SanitizableData.java @@ -76,7 +76,7 @@ public Object getValue() { } /** - * Return a new {@link SanitizableData} instance with sanatized value. + * Return a new {@link SanitizableData} instance with sanitized value. * @return a new sanitizable data instance. * @since 3.1.0 */ diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/DiscoveredOperationMethod.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/DiscoveredOperationMethod.java index 4eb94e4066d0..1658623dc4d7 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/DiscoveredOperationMethod.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/DiscoveredOperationMethod.java @@ -44,11 +44,11 @@ public DiscoveredOperationMethod(Method method, OperationType operationType, Assert.notNull(annotationAttributes, "AnnotationAttributes must not be null"); List producesMediaTypes = new ArrayList<>(); producesMediaTypes.addAll(Arrays.asList(annotationAttributes.getStringArray("produces"))); - producesMediaTypes.addAll(getProducesFromProducable(annotationAttributes)); + producesMediaTypes.addAll(getProducesFromProducible(annotationAttributes)); this.producesMediaTypes = Collections.unmodifiableList(producesMediaTypes); } - private & Producible> List getProducesFromProducable( + private & Producible> List getProducesFromProducible( AnnotationAttributes annotationAttributes) { Class type = getProducesFrom(annotationAttributes); if (type == Producible.class) { From 5cfd079c55e754c8febba8015adbbfaf8b301831 Mon Sep 17 00:00:00 2001 From: Yanming Zhou Date: Fri, 31 May 2024 15:50:36 +0800 Subject: [PATCH 018/108] Remove unnecessary null check See gh-40963 --- .../context/properties/source/ConfigurationPropertySources.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertySources.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertySources.java index dac0b1051398..e7e0fddf9933 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertySources.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertySources.java @@ -87,7 +87,7 @@ public static void attach(Environment environment) { Assert.isInstanceOf(ConfigurableEnvironment.class, environment); MutablePropertySources sources = ((ConfigurableEnvironment) environment).getPropertySources(); PropertySource attached = getAttached(sources); - if (attached == null || !isUsingSources(attached, sources)) { + if (!isUsingSources(attached, sources)) { attached = new ConfigurationPropertySourcesPropertySource(ATTACHED_PROPERTY_SOURCE_NAME, new SpringConfigurationPropertySources(sources)); } From 3c8b6828a527f531eeb58b8701317a293e0ebb1f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 19:05:58 +0000 Subject: [PATCH 019/108] Bump jfrog/setup-jfrog-cli from 4.0.2 to 4.1.2 Bumps [jfrog/setup-jfrog-cli](https://github.com/jfrog/setup-jfrog-cli) from 4.0.2 to 4.1.2. - [Release notes](https://github.com/jfrog/setup-jfrog-cli/releases) - [Commits](https://github.com/jfrog/setup-jfrog-cli/compare/727b480bafd0d8adbdfdb2257a7d7c2e08eb1779...7c95feb32008765e1b4e626b078dfd897c4340ad) --- updated-dependencies: - dependency-name: jfrog/setup-jfrog-cli dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] See gh-40980 --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9ef67270458b..7c80a04a25f1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -71,7 +71,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up JFrog CLI - uses: jfrog/setup-jfrog-cli@727b480bafd0d8adbdfdb2257a7d7c2e08eb1779 # v4.0.2 + uses: jfrog/setup-jfrog-cli@7c95feb32008765e1b4e626b078dfd897c4340ad # v4.1.2 env: JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} - name: Promote build From 054a1a0c0f95a513b8ec170ae132df6ea9c874c5 Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Tue, 4 Jun 2024 09:09:23 +0200 Subject: [PATCH 020/108] Polish "Bump jfrog/setup-jfrog-cli from 4.0.2 to 4.1.2" See gh-40980 --- .github/actions/publish-gradle-plugin/action.yml | 2 +- .github/actions/sync-to-maven-central/action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/publish-gradle-plugin/action.yml b/.github/actions/publish-gradle-plugin/action.yml index ee61f9feb9ec..e5efb3716779 100644 --- a/.github/actions/publish-gradle-plugin/action.yml +++ b/.github/actions/publish-gradle-plugin/action.yml @@ -21,7 +21,7 @@ runs: using: composite steps: - name: Set Up JFrog CLI - uses: jfrog/setup-jfrog-cli@727b480bafd0d8adbdfdb2257a7d7c2e08eb1779 # v4.0.2 + uses: jfrog/setup-jfrog-cli@7c95feb32008765e1b4e626b078dfd897c4340ad # v4.1.2 env: JF_ENV_SPRING: ${{ inputs.jfrog-cli-config-token }} - name: Download Artifacts diff --git a/.github/actions/sync-to-maven-central/action.yml b/.github/actions/sync-to-maven-central/action.yml index ef74ce2f6cf9..22623d6e28aa 100644 --- a/.github/actions/sync-to-maven-central/action.yml +++ b/.github/actions/sync-to-maven-central/action.yml @@ -20,7 +20,7 @@ runs: using: composite steps: - name: Set Up JFrog CLI - uses: jfrog/setup-jfrog-cli@727b480bafd0d8adbdfdb2257a7d7c2e08eb1779 # v4.0.2 + uses: jfrog/setup-jfrog-cli@7c95feb32008765e1b4e626b078dfd897c4340ad # v4.1.2 env: JF_ENV_SPRING: ${{ inputs.jfrog-cli-config-token }} - name: Download Release Artifacts From 2ceb7b42170c15bb1f1452709667c552b1b33718 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 5 Jun 2024 12:08:14 +0100 Subject: [PATCH 021/108] Extract LoaderHidingResource as a top-level type See gh-39472 --- .../jetty/JettyServletWebServerFactory.java | 158 --------------- .../embedded/jetty/LoaderHidingResource.java | 186 ++++++++++++++++++ 2 files changed, 186 insertions(+), 158 deletions(-) create mode 100644 spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/LoaderHidingResource.java diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java index 63f0299463bb..194fa32ba267 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java @@ -17,27 +17,18 @@ package org.springframework.boot.web.embedded.jetty; import java.io.File; -import java.io.IOException; -import java.io.InputStream; import java.net.InetSocketAddress; -import java.net.URI; import java.net.URL; -import java.nio.channels.ReadableByteChannel; -import java.nio.file.Path; import java.time.Duration; -import java.time.Instant; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.EventListener; -import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; import java.util.Objects; import java.util.Set; -import java.util.Spliterator; import java.util.UUID; -import java.util.function.Consumer; import jakarta.servlet.http.Cookie; import org.eclipse.jetty.ee10.servlet.ErrorHandler; @@ -79,7 +70,6 @@ import org.eclipse.jetty.session.FileSessionDataStore; import org.eclipse.jetty.session.SessionConfig; import org.eclipse.jetty.util.Callback; -import org.eclipse.jetty.util.resource.CombinedResource; import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.util.resource.ResourceFactory; import org.eclipse.jetty.util.resource.URLResourceFactory; @@ -593,154 +583,6 @@ private void addJettyErrorPages(ErrorHandler errorHandler, Collection } } - private static final class LoaderHidingResource extends Resource { - - private static final String LOADER_RESOURCE_PATH_PREFIX = "/org/springframework/boot/"; - - private final Resource base; - - private final Resource delegate; - - private LoaderHidingResource(Resource base, Resource delegate) { - this.base = base; - this.delegate = delegate; - } - - @Override - public void forEach(Consumer action) { - this.delegate.forEach(action); - } - - @Override - public Path getPath() { - return this.delegate.getPath(); - } - - @Override - public boolean isContainedIn(Resource r) { - return this.delegate.isContainedIn(r); - } - - @Override - public Iterator iterator() { - if (this.delegate instanceof CombinedResource) { - return list().iterator(); - } - return List.of(this).iterator(); - } - - @Override - public boolean equals(Object obj) { - return this.delegate.equals(obj); - } - - @Override - public int hashCode() { - return this.delegate.hashCode(); - } - - @Override - public boolean exists() { - return this.delegate.exists(); - } - - @Override - public Spliterator spliterator() { - return this.delegate.spliterator(); - } - - @Override - public boolean isDirectory() { - return this.delegate.isDirectory(); - } - - @Override - public boolean isReadable() { - return this.delegate.isReadable(); - } - - @Override - public Instant lastModified() { - return this.delegate.lastModified(); - } - - @Override - public long length() { - return this.delegate.length(); - } - - @Override - public URI getURI() { - return this.delegate.getURI(); - } - - @Override - public String getName() { - return this.delegate.getName(); - } - - @Override - public String getFileName() { - return this.delegate.getFileName(); - } - - @Override - public InputStream newInputStream() throws IOException { - return this.delegate.newInputStream(); - } - - @Override - @SuppressWarnings({ "deprecation", "removal" }) - public ReadableByteChannel newReadableByteChannel() throws IOException { - return this.delegate.newReadableByteChannel(); - } - - @Override - public List list() { - return this.delegate.list().stream().filter(this::nonLoaderResource).toList(); - } - - private boolean nonLoaderResource(Resource resource) { - Path prefix = this.base.getPath().resolve(Path.of("org", "springframework", "boot")); - return !resource.getPath().startsWith(prefix); - } - - @Override - public Resource resolve(String subUriPath) { - if (subUriPath.startsWith(LOADER_RESOURCE_PATH_PREFIX)) { - return null; - } - Resource resolved = this.delegate.resolve(subUriPath); - return (resolved != null) ? new LoaderHidingResource(this.base, resolved) : null; - } - - @Override - public boolean isAlias() { - return this.delegate.isAlias(); - } - - @Override - public URI getRealURI() { - return this.delegate.getRealURI(); - } - - @Override - public void copyTo(Path destination) throws IOException { - this.delegate.copyTo(destination); - } - - @Override - public Collection getAllResources() { - return this.delegate.getAllResources().stream().filter(this::nonLoaderResource).toList(); - } - - @Override - public String toString() { - return this.delegate.toString(); - } - - } - /** * {@link AbstractConfiguration} to apply {@code @WebListener} classes. */ diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/LoaderHidingResource.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/LoaderHidingResource.java new file mode 100644 index 000000000000..4d76f5df8d71 --- /dev/null +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/LoaderHidingResource.java @@ -0,0 +1,186 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.web.embedded.jetty; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.nio.channels.ReadableByteChannel; +import java.nio.file.Path; +import java.time.Instant; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Spliterator; +import java.util.function.Consumer; + +import org.eclipse.jetty.util.resource.CombinedResource; +import org.eclipse.jetty.util.resource.Resource; + +/** + * A custom {@link Resource} that hides Spring Boot's loader classes, preventing them from + * being served over HTTP. + * + * @author Andy Wilkinson + */ +final class LoaderHidingResource extends Resource { + + private static final String LOADER_RESOURCE_PATH_PREFIX = "/org/springframework/boot/"; + + private final Resource base; + + private final Resource delegate; + + LoaderHidingResource(Resource base, Resource delegate) { + this.base = base; + this.delegate = delegate; + } + + @Override + public void forEach(Consumer action) { + this.delegate.forEach(action); + } + + @Override + public Path getPath() { + return this.delegate.getPath(); + } + + @Override + public boolean isContainedIn(Resource r) { + return this.delegate.isContainedIn(r); + } + + @Override + public Iterator iterator() { + if (this.delegate instanceof CombinedResource) { + return list().iterator(); + } + return List.of(this).iterator(); + } + + @Override + public boolean equals(Object obj) { + return this.delegate.equals(obj); + } + + @Override + public int hashCode() { + return this.delegate.hashCode(); + } + + @Override + public boolean exists() { + return this.delegate.exists(); + } + + @Override + public Spliterator spliterator() { + return this.delegate.spliterator(); + } + + @Override + public boolean isDirectory() { + return this.delegate.isDirectory(); + } + + @Override + public boolean isReadable() { + return this.delegate.isReadable(); + } + + @Override + public Instant lastModified() { + return this.delegate.lastModified(); + } + + @Override + public long length() { + return this.delegate.length(); + } + + @Override + public URI getURI() { + return this.delegate.getURI(); + } + + @Override + public String getName() { + return this.delegate.getName(); + } + + @Override + public String getFileName() { + return this.delegate.getFileName(); + } + + @Override + public InputStream newInputStream() throws IOException { + return this.delegate.newInputStream(); + } + + @Override + @SuppressWarnings({ "deprecation", "removal" }) + public ReadableByteChannel newReadableByteChannel() throws IOException { + return this.delegate.newReadableByteChannel(); + } + + @Override + public List list() { + return this.delegate.list().stream().filter(this::nonLoaderResource).toList(); + } + + private boolean nonLoaderResource(Resource resource) { + Path prefix = this.base.getPath().resolve(Path.of("org", "springframework", "boot")); + return !resource.getPath().startsWith(prefix); + } + + @Override + public Resource resolve(String subUriPath) { + if (subUriPath.startsWith(LOADER_RESOURCE_PATH_PREFIX)) { + return null; + } + Resource resolved = this.delegate.resolve(subUriPath); + return (resolved != null) ? new LoaderHidingResource(this.base, resolved) : null; + } + + @Override + public boolean isAlias() { + return this.delegate.isAlias(); + } + + @Override + public URI getRealURI() { + return this.delegate.getRealURI(); + } + + @Override + public void copyTo(Path destination) throws IOException { + this.delegate.copyTo(destination); + } + + @Override + public Collection getAllResources() { + return this.delegate.getAllResources().stream().filter(this::nonLoaderResource).toList(); + } + + @Override + public String toString() { + return this.delegate.toString(); + } + +} From d4e9f458a38a91d60eed4a7f0d3a2597a105ca8a Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 5 Jun 2024 12:13:43 +0100 Subject: [PATCH 022/108] Fix path handling and wrapping in LoaderHidingResource Closes gh-39472 --- .../embedded/jetty/LoaderHidingResource.java | 18 ++- .../jetty/LoaderHidingResourceTests.java | 104 ++++++++++++++++++ 2 files changed, 118 insertions(+), 4 deletions(-) create mode 100644 spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/LoaderHidingResourceTests.java diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/LoaderHidingResource.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/LoaderHidingResource.java index 4d76f5df8d71..ed42fc05ddc6 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/LoaderHidingResource.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/LoaderHidingResource.java @@ -41,6 +41,8 @@ final class LoaderHidingResource extends Resource { private static final String LOADER_RESOURCE_PATH_PREFIX = "/org/springframework/boot/"; + private final Path loaderBasePath; + private final Resource base; private final Resource delegate; @@ -48,6 +50,7 @@ final class LoaderHidingResource extends Resource { LoaderHidingResource(Resource base, Resource delegate) { this.base = base; this.delegate = delegate; + this.loaderBasePath = base.getPath().getFileSystem().getPath("/", "org", "springframework", "boot"); } @Override @@ -141,12 +144,19 @@ public ReadableByteChannel newReadableByteChannel() throws IOException { @Override public List list() { - return this.delegate.list().stream().filter(this::nonLoaderResource).toList(); + return asLoaderHidingResources(this.delegate.list()); } private boolean nonLoaderResource(Resource resource) { - Path prefix = this.base.getPath().resolve(Path.of("org", "springframework", "boot")); - return !resource.getPath().startsWith(prefix); + return !resource.getPath().startsWith(this.loaderBasePath); + } + + private List asLoaderHidingResources(Collection resources) { + return resources.stream().filter(this::nonLoaderResource).map(this::asLoaderHidingResource).toList(); + } + + private Resource asLoaderHidingResource(Resource resource) { + return (resource instanceof LoaderHidingResource) ? resource : new LoaderHidingResource(this.base, resource); } @Override @@ -175,7 +185,7 @@ public void copyTo(Path destination) throws IOException { @Override public Collection getAllResources() { - return this.delegate.getAllResources().stream().filter(this::nonLoaderResource).toList(); + return asLoaderHidingResources(this.delegate.getAllResources()); } @Override diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/LoaderHidingResourceTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/LoaderHidingResourceTests.java new file mode 100644 index 000000000000..b3b96692421e --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/jetty/LoaderHidingResourceTests.java @@ -0,0 +1,104 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.web.embedded.jetty; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.URI; +import java.nio.file.FileSystems; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.jar.JarOutputStream; +import java.util.zip.ZipEntry; + +import org.eclipse.jetty.util.resource.PathResourceFactory; +import org.eclipse.jetty.util.resource.Resource; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * Tests for {@link LoaderHidingResource}. + * + * @author Andy Wilkinson + */ +class LoaderHidingResourceTests { + + @Test + void listHidesLoaderResources(@TempDir File temp) throws IOException { + URI warUri = createExampleWar(temp); + Resource resource = new PathResourceFactory().newResource(warUri); + LoaderHidingResource loaderHidingResource = new LoaderHidingResource(resource, resource); + assertThat(deepList(loaderHidingResource)).hasOnlyElementsOfType(LoaderHidingResource.class) + .extracting(Resource::getName) + .contains("/assets/image.jpg") + .doesNotContain("/org/springframework/boot/Loader.class"); + } + + @Test + void getAllResourcesHidesLoaderResources(@TempDir File temp) throws IOException { + URI warUri = createExampleWar(temp); + Resource resource = new PathResourceFactory().newResource(warUri); + LoaderHidingResource loaderHidingResource = new LoaderHidingResource(resource, resource); + Collection allResources = loaderHidingResource.getAllResources(); + assertThat(allResources).hasOnlyElementsOfType(LoaderHidingResource.class) + .extracting(Resource::getName) + .contains("/assets/image.jpg") + .doesNotContain("/org/springframework/boot/Loader.class"); + } + + @Test + void resolveHidesLoaderResources(@TempDir File temp) throws IOException { + URI warUri = createExampleWar(temp); + Resource resource = new PathResourceFactory().newResource(warUri); + LoaderHidingResource loaderHidingResource = new LoaderHidingResource(resource, resource); + assertThat(loaderHidingResource.resolve("/assets/image.jpg").exists()).isTrue(); + assertThat(loaderHidingResource.resolve("/assets/image.jpg")).isInstanceOf(LoaderHidingResource.class); + assertThat(loaderHidingResource.resolve("/assets/non-existent.jpg").exists()).isFalse(); + assertThat(loaderHidingResource.resolve("/assets/non-existent.jpg")).isInstanceOf(LoaderHidingResource.class); + assertThat(loaderHidingResource.resolve("/org/springframework/boot/Loader.class")).isNull(); + } + + private URI createExampleWar(File temp) throws IOException { + File exampleWarFile = new File(temp, "example.war"); + try (JarOutputStream out = new JarOutputStream(new FileOutputStream(exampleWarFile))) { + out.putNextEntry(new ZipEntry("org/")); + out.putNextEntry(new ZipEntry("org/springframework/")); + out.putNextEntry(new ZipEntry("org/springframework/boot/")); + out.putNextEntry(new ZipEntry("org/springframework/boot/Loader.class")); + out.putNextEntry(new ZipEntry("assets/")); + out.putNextEntry(new ZipEntry("assets/image.jpg")); + } + URI warUri = URI.create("jar:" + exampleWarFile.toURI() + "!/"); + FileSystems.newFileSystem(warUri, Collections.emptyMap()); + return warUri; + } + + private List deepList(Resource resource) { + List all = new ArrayList<>(); + for (Resource listed : resource.list()) { + all.add(listed); + all.addAll(deepList(listed)); + } + return all; + } + +} From 217c2c862b0141787ed62b0acbc691f770072239 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 6 Jun 2024 13:28:36 +0100 Subject: [PATCH 023/108] Ignore file entries in META-INF/versions of multi-release jar Fixes gh-41001 --- .../boot/loader/jar/MetaInfVersionsInfo.java | 20 ++++++++++--------- .../loader/jar/MetaInfVersionsInfoTests.java | 16 ++++++++++++++- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/MetaInfVersionsInfo.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/MetaInfVersionsInfo.java index caf76a2b96f6..87576693f5ef 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/MetaInfVersionsInfo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/MetaInfVersionsInfo.java @@ -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. @@ -82,15 +82,17 @@ static MetaInfVersionsInfo get(int size, IntFunction entries) if (contentEntry.hasNameStartingWith(META_INF_VERSIONS) && !contentEntry.isDirectory()) { String name = contentEntry.getName(); int slash = name.indexOf('/', META_INF_VERSIONS.length()); - String version = name.substring(META_INF_VERSIONS.length(), slash); - try { - int versionNumber = Integer.parseInt(version); - if (versionNumber >= NestedJarFile.BASE_VERSION) { - versions.add(versionNumber); + if (slash > -1) { + String version = name.substring(META_INF_VERSIONS.length(), slash); + try { + int versionNumber = Integer.parseInt(version); + if (versionNumber >= NestedJarFile.BASE_VERSION) { + versions.add(versionNumber); + } + } + catch (NumberFormatException ex) { + // Ignore } - } - catch (NumberFormatException ex) { - // Ignore } } } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/MetaInfVersionsInfoTests.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/MetaInfVersionsInfoTests.java index d556c9cbea57..0c0341fe0fc7 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/MetaInfVersionsInfoTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/test/java/org/springframework/boot/loader/jar/MetaInfVersionsInfoTests.java @@ -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. @@ -72,6 +72,20 @@ void getWhenHasNoEntriesReturnsNone() { assertThat(info).isSameAs(MetaInfVersionsInfo.NONE); } + @Test + void toleratesUnexpectedFileEntryInMetaInfVersions() { + List entries = new ArrayList<>(); + entries.add(mockEntry("META-INF/")); + entries.add(mockEntry("META-INF/MANIFEST.MF")); + entries.add(mockEntry("META-INF/versions/")); + entries.add(mockEntry("META-INF/versions/unexpected")); + entries.add(mockEntry("META-INF/versions/9/")); + entries.add(mockEntry("META-INF/versions/9/Foo.class")); + MetaInfVersionsInfo info = MetaInfVersionsInfo.get(entries.size(), entries::get); + assertThat(info.versions()).containsExactly(9); + assertThat(info.directories()).containsExactly("META-INF/versions/9/"); + } + private ZipContent.Entry mockEntry(String name) { ZipContent.Entry entry = mock(ZipContent.Entry.class); given(entry.getName()).willReturn(name); From fe536bf0752db07c6f4a9410998a9d5de0067de6 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 7 Jun 2024 12:46:19 +0100 Subject: [PATCH 024/108] Allow SSL to be used with Tomcat's Http11Nio2Protocol Fixes gh-41007 --- .../embedded/tomcat/SslConnectorCustomizer.java | 11 ++++------- .../TomcatServletWebServerFactoryTests.java | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/SslConnectorCustomizer.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/SslConnectorCustomizer.java index 75601111c1df..bbf29699a8f0 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/SslConnectorCustomizer.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/SslConnectorCustomizer.java @@ -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. @@ -20,7 +20,6 @@ import org.apache.commons.logging.Log; import org.apache.coyote.ProtocolHandler; import org.apache.coyote.http11.AbstractHttp11JsseProtocol; -import org.apache.coyote.http11.Http11NioProtocol; import org.apache.tomcat.util.net.SSLHostConfig; import org.apache.tomcat.util.net.SSLHostConfigCertificate; import org.apache.tomcat.util.net.SSLHostConfigCertificate.Type; @@ -104,7 +103,7 @@ private void applySslBundle(SslBundle sslBundle, AbstractHttp11JsseProtocol p String ciphers = StringUtils.arrayToCommaDelimitedString(options.getCiphers()); sslHostConfig.setCiphers(ciphers); } - configureSslStoreProvider(protocol, sslHostConfig, certificate, stores); + configureSslStores(sslHostConfig, certificate, stores); configureEnabledProtocols(sslHostConfig, options); } @@ -119,10 +118,8 @@ private void configureSslClientAuth(SSLHostConfig config) { config.setCertificateVerification(ClientAuth.map(this.clientAuth, "none", "optional", "required")); } - private void configureSslStoreProvider(AbstractHttp11JsseProtocol protocol, SSLHostConfig sslHostConfig, - SSLHostConfigCertificate certificate, SslStoreBundle stores) { - Assert.isInstanceOf(Http11NioProtocol.class, protocol, - "SslStoreProvider can only be used with Http11NioProtocol"); + private void configureSslStores(SSLHostConfig sslHostConfig, SSLHostConfigCertificate certificate, + SslStoreBundle stores) { try { if (stores.getKeyStore() != null) { certificate.setCertificateKeystore(stores.getKeyStore()); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java index 67eb768b9d37..c3236a951744 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactoryTests.java @@ -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. @@ -60,6 +60,7 @@ import org.apache.catalina.valves.RemoteIpValve; import org.apache.coyote.ProtocolHandler; import org.apache.coyote.http11.AbstractHttp11Protocol; +import org.apache.coyote.http11.Http11Nio2Protocol; import org.apache.hc.client5.http.HttpHostConnectException; import org.apache.hc.client5.http.classic.HttpClient; import org.apache.hc.client5.http.impl.classic.HttpClients; @@ -682,6 +683,20 @@ void shouldUpdateSslWhenReloadingSslBundles() throws Exception { assertThat(verifier.getLastPrincipal()).isEqualTo("CN=2"); } + @Test + void sslWithHttp11Nio2Protocol() throws Exception { + TomcatServletWebServerFactory factory = getFactory(); + addTestTxtFile(factory); + factory.setProtocol(Http11Nio2Protocol.class.getName()); + factory.setSsl(getSsl(null, "password", "src/test/resources/test.jks")); + this.webServer = factory.getWebServer(); + this.webServer.start(); + SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory( + new SSLContextBuilder().loadTrustMaterial(null, new TrustSelfSignedStrategy()).build()); + HttpComponentsClientHttpRequestFactory requestFactory = createHttpComponentsRequestFactory(socketFactory); + assertThat(getResponse(getLocalUrl("https", "/test.txt"), requestFactory)).isEqualTo("test"); + } + @Override protected JspServlet getJspServlet() throws ServletException { Tomcat tomcat = ((TomcatWebServer) this.webServer).getTomcat(); From 73315b607fe68bb32760abeef6562a2bc58abc77 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 10 Jun 2024 10:21:26 +0100 Subject: [PATCH 025/108] Start building against Micrometer 1.12.7 snapshots See gh-41015 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 091bd9145575..a529570f0d43 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -995,7 +995,7 @@ bom { ] } } - library("Micrometer", "1.12.6") { + library("Micrometer", "1.12.7-SNAPSHOT") { considerSnapshots() group("io.micrometer") { modules = [ From 1eb1dade94e5112e9f48fd6d76e7efd76039d251 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 10 Jun 2024 10:23:03 +0100 Subject: [PATCH 026/108] Start building against Micrometer Tracing 1.2.7 snapshots See gh-41027 --- spring-boot-project/spring-boot-dependencies/build.gradle | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index a529570f0d43..fcbee16866d3 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1008,9 +1008,8 @@ bom { ] } } - library("Micrometer Tracing", "1.2.6") { + library("Micrometer Tracing", "1.2.7-SNAPSHOT") { considerSnapshots() - calendarName = "Tracing" group("io.micrometer") { imports = [ "micrometer-tracing-bom" From a620bb420103bc9b6bb3ebb455fea7fe21b0b319 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 10 Jun 2024 10:21:30 +0100 Subject: [PATCH 027/108] Start building against Reactor Bom 2023.0.7 snapshots See gh-41016 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index fcbee16866d3..1d10373fbdb7 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1382,7 +1382,7 @@ bom { ] } } - library("Reactor Bom", "2023.0.6") { + library("Reactor Bom", "2023.0.7-SNAPSHOT") { considerSnapshots() calendarName = "Reactor" group("io.projectreactor") { From a2b1638d77d2ca5cca6d129bfbcd6b1ec013ebec Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 10 Jun 2024 10:21:35 +0100 Subject: [PATCH 028/108] Start building against Spring Authorization Server 1.2.5 snapshots See gh-41017 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 1d10373fbdb7..6b39b50880cc 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1558,7 +1558,7 @@ bom { ] } } - library("Spring Authorization Server", "1.2.4") { + library("Spring Authorization Server", "1.2.5-SNAPSHOT") { considerSnapshots() group("org.springframework.security") { modules = [ From 34b99bd6be4ed5c68bbfb639298ef058a03facb3 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 10 Jun 2024 10:21:39 +0100 Subject: [PATCH 029/108] Start building against Spring Data Bom 2023.1.7 snapshots See gh-41018 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 6b39b50880cc..afc2492d2a3b 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1574,7 +1574,7 @@ bom { ] } } - library("Spring Data Bom", "2023.1.6") { + library("Spring Data Bom", "2023.1.7-SNAPSHOT") { considerSnapshots() calendarName = "Spring Data Release" group("org.springframework.data") { From 26692a7f2601084b893aa46c31a79b8744cf7e14 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 10 Jun 2024 10:26:08 +0100 Subject: [PATCH 030/108] Upgrade to Neo4j Java Driver 5.21.0 Closes gh-41028 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index afc2492d2a3b..0f00d3236acd 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1069,7 +1069,7 @@ bom { ] } } - library("Neo4j Java Driver", "5.20.0") { + library("Neo4j Java Driver", "5.21.0") { alignWith { version { from "org.springframework.data:spring-data-neo4j" From 2a7708c8cf1b4549c91c6eecfc4cb620c2ac4541 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 10 Jun 2024 10:21:44 +0100 Subject: [PATCH 031/108] Start building against Spring Framework 6.1.9 snapshots See gh-41019 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 8168f400a3b4..7faba73b95fa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ junitJupiterVersion=5.10.2 kotlinVersion=1.9.24 mavenVersion=3.9.4 nativeBuildToolsVersion=0.9.28 -springFrameworkVersion=6.1.8 +springFrameworkVersion=6.1.9-SNAPSHOT springFramework60xVersion=6.0.21 tomcatVersion=10.1.24 From be33a3579c8e0db396ea0351009a3781de867d3e Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 10 Jun 2024 10:21:48 +0100 Subject: [PATCH 032/108] Start building against Spring GraphQL 1.2.7 snapshots See gh-41020 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 0f00d3236acd..f80ac809c0c2 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1592,7 +1592,7 @@ bom { ] } } - library("Spring GraphQL", "1.2.6") { + library("Spring GraphQL", "1.2.7-SNAPSHOT") { considerSnapshots() group("org.springframework.graphql") { modules = [ From 5f185df451dca4c5ca82113328a3586c30bcb0f6 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 10 Jun 2024 10:21:53 +0100 Subject: [PATCH 033/108] Start building against Spring Integration 6.2.6 snapshots See gh-41021 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index f80ac809c0c2..7b365477661c 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1609,7 +1609,7 @@ bom { ] } } - library("Spring Integration", "6.2.5") { + library("Spring Integration", "6.2.6-SNAPSHOT") { considerSnapshots() group("org.springframework.integration") { imports = [ From a09e0e00b8e64c031101acf1d3497633cb55b147 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 10 Jun 2024 10:21:57 +0100 Subject: [PATCH 034/108] Start building against Spring Kafka 3.1.6 snapshots See gh-41022 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 7b365477661c..0e79410ca682 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1617,7 +1617,7 @@ bom { ] } } - library("Spring Kafka", "3.1.5") { + library("Spring Kafka", "3.1.6-SNAPSHOT") { considerSnapshots() group("org.springframework.kafka") { modules = [ From a253ede0c1f1bef923806f560fe532d061b6df6b Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 10 Jun 2024 10:22:01 +0100 Subject: [PATCH 035/108] Start building against Spring LDAP 3.2.4 snapshots See gh-41023 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 0e79410ca682..307e92a1f29b 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1626,7 +1626,7 @@ bom { ] } } - library("Spring LDAP", "3.2.3") { + library("Spring LDAP", "3.2.4-SNAPSHOT") { considerSnapshots() group("org.springframework.ldap") { modules = [ From 70a12d79ec83d9260785b45a4fc7dae6b2ac112e Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 10 Jun 2024 10:22:06 +0100 Subject: [PATCH 036/108] Start building against Spring Pulsar 1.0.7 snapshots See gh-41024 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 307e92a1f29b..12aaa17c7f2e 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1637,7 +1637,7 @@ bom { ] } } - library("Spring Pulsar", "1.0.6") { + library("Spring Pulsar", "1.0.7-SNAPSHOT") { considerSnapshots() group("org.springframework.pulsar") { imports = [ From b1e8216ccbf21f85a574895b46de8cfcb092b0c4 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 10 Jun 2024 10:22:10 +0100 Subject: [PATCH 037/108] Start building against Spring Security 6.2.5 snapshots See gh-41025 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 12aaa17c7f2e..53690370735b 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1661,7 +1661,7 @@ bom { ] } } - library("Spring Security", "6.2.4") { + library("Spring Security", "6.2.5-SNAPSHOT") { considerSnapshots() group("org.springframework.security") { imports = [ From 45e4f137deb73b25af37138fcfbeff1049f20551 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 10 Jun 2024 10:22:15 +0100 Subject: [PATCH 038/108] Start building against Spring Session 3.2.4 snapshots See gh-41026 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 53690370735b..387987183cc7 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1669,7 +1669,7 @@ bom { ] } } - library("Spring Session", "3.2.3") { + library("Spring Session", "3.2.4-SNAPSHOT") { considerSnapshots() prohibit { startsWith(["Apple-", "Bean-", "Corn-", "Dragonfruit-"]) From 2bb74b261c44b5c9b1a9f3a312e9d447fac0886b Mon Sep 17 00:00:00 2001 From: Scott Frederick Date: Mon, 10 Jun 2024 17:27:02 -0500 Subject: [PATCH 039/108] Disable stale checking for local Docker daemon connections Fixes gh-40697 --- .../platform/docker/transport/LocalHttpClientTransport.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport/LocalHttpClientTransport.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport/LocalHttpClientTransport.java index cdafa07e40be..64b19c3cc2d6 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport/LocalHttpClientTransport.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport/LocalHttpClientTransport.java @@ -26,6 +26,7 @@ import org.apache.hc.client5.http.DnsResolver; import org.apache.hc.client5.http.HttpRoute; import org.apache.hc.client5.http.classic.HttpClient; +import org.apache.hc.client5.http.config.ConnectionConfig; import org.apache.hc.client5.http.impl.classic.HttpClientBuilder; import org.apache.hc.client5.http.impl.classic.HttpClients; import org.apache.hc.client5.http.impl.io.BasicHttpClientConnectionManager; @@ -73,8 +74,13 @@ static LocalHttpClientTransport create(ResolvedDockerHost dockerHost) { */ private static class LocalConnectionManager extends BasicHttpClientConnectionManager { + private static final ConnectionConfig CONNECTION_CONFIG = ConnectionConfig.copy(ConnectionConfig.DEFAULT) + .setValidateAfterInactivity(TimeValue.NEG_ONE_MILLISECOND) + .build(); + LocalConnectionManager(String host) { super(getRegistry(host), null, null, new LocalDnsResolver()); + setConnectionConfig(CONNECTION_CONFIG); } private static Registry getRegistry(String host) { From 80b7107c56e690d50514256c89b4587db70bfb1d Mon Sep 17 00:00:00 2001 From: Mateus Scheper Date: Mon, 10 Jun 2024 21:15:50 -0300 Subject: [PATCH 040/108] Improve readability of the documentation See gh-41051 --- .../src/docs/asciidoc/actuator/observability.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/observability.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/observability.adoc index 11b641484d33..8175b7dd62fd 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/observability.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/observability.adoc @@ -1,7 +1,7 @@ [[actuator.observability]] == Observability Observability is the ability to observe the internal state of a running system from the outside. -It consists of the three pillars logging, metrics and traces. +It consists of the three pillars: logging, metrics and traces. For metrics and traces, Spring Boot uses https://micrometer.io/docs/observation[Micrometer Observation]. To create your own observations (which will lead to metrics and traces), you can inject an `ObservationRegistry`. From 8920c2f26932e53b81bf7e8729261b1852008986 Mon Sep 17 00:00:00 2001 From: Donghoon Lee Date: Tue, 11 Jun 2024 11:12:02 +0900 Subject: [PATCH 041/108] Fix typo in javadoc See gh-41052 --- .../boot/test/web/client/MockServerRestClientCustomizer.java | 4 ++-- .../test/web/client/MockServerRestTemplateCustomizer.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/MockServerRestClientCustomizer.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/MockServerRestClientCustomizer.java index 29b8345140b8..8df7a066d00c 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/MockServerRestClientCustomizer.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/MockServerRestClientCustomizer.java @@ -70,7 +70,7 @@ public MockServerRestClientCustomizer() { } /** - * Crate a new {@link MockServerRestClientCustomizer} instance. + * Create a new {@link MockServerRestClientCustomizer} instance. * @param expectationManager the expectation manager class to use */ public MockServerRestClientCustomizer(Class expectationManager) { @@ -79,7 +79,7 @@ public MockServerRestClientCustomizer(Class } /** - * Crate a new {@link MockServerRestClientCustomizer} instance. + * Create a new {@link MockServerRestClientCustomizer} instance. * @param expectationManagerSupplier a supplier that provides the * {@link RequestExpectationManager} to use * @since 3.0.0 diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/MockServerRestTemplateCustomizer.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/MockServerRestTemplateCustomizer.java index aabcd34437ea..19dcc272362e 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/MockServerRestTemplateCustomizer.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/MockServerRestTemplateCustomizer.java @@ -73,7 +73,7 @@ public MockServerRestTemplateCustomizer() { } /** - * Crate a new {@link MockServerRestTemplateCustomizer} instance. + * Create a new {@link MockServerRestTemplateCustomizer} instance. * @param expectationManager the expectation manager class to use */ public MockServerRestTemplateCustomizer(Class expectationManager) { @@ -82,7 +82,7 @@ public MockServerRestTemplateCustomizer(Class Date: Tue, 11 Jun 2024 13:24:42 +0100 Subject: [PATCH 042/108] Upgrade to Byte Buddy 1.14.17 Closes gh-41054 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 387987183cc7..484b92ba98ee 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -123,7 +123,7 @@ bom { ] } } - library("Byte Buddy", "1.14.16") { + library("Byte Buddy", "1.14.17") { group("net.bytebuddy") { modules = [ "byte-buddy", From 60e02f83d87710bf412c71c2d07e523a10127fa0 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 11 Jun 2024 13:24:47 +0100 Subject: [PATCH 043/108] Upgrade to Dropwizard Metrics 4.2.26 Closes gh-41055 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 484b92ba98ee..9696a31ca033 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -247,7 +247,7 @@ bom { ] } } - library("Dropwizard Metrics", "4.2.25") { + library("Dropwizard Metrics", "4.2.26") { group("io.dropwizard.metrics") { imports = [ "metrics-bom" From a51102319f29fb5a5b96053c007aa391ff74ec5d Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 11 Jun 2024 13:24:52 +0100 Subject: [PATCH 044/108] Upgrade to FreeMarker 2.3.33 Closes gh-41056 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 9696a31ca033..084405080761 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -300,7 +300,7 @@ bom { ] } } - library("FreeMarker", "2.3.32") { + library("FreeMarker", "2.3.33") { group("org.freemarker") { modules = [ "freemarker" From c703dbad1ea2fc44d812a575d4998b804d735495 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 11 Jun 2024 13:24:56 +0100 Subject: [PATCH 045/108] Upgrade to HSQLDB 2.7.3 Closes gh-41057 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 084405080761..14a153690a6a 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -413,7 +413,7 @@ bom { ] } } - library("HSQLDB", "2.7.2") { + library("HSQLDB", "2.7.3") { group("org.hsqldb") { modules = [ "hsqldb" From 62008fe6d542061af86bdb426491e4b09a0ae8b2 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 11 Jun 2024 13:25:01 +0100 Subject: [PATCH 046/108] Upgrade to Jersey 3.1.7 Closes gh-41058 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 14a153690a6a..70690023d5ee 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -664,7 +664,7 @@ bom { ] } } - library("Jersey", "3.1.6") { + library("Jersey", "3.1.7") { group("org.glassfish.jersey") { imports = [ "jersey-bom" From db7efbbe82d9e0fda4037e5257e8ec37a592a983 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 11 Jun 2024 13:25:06 +0100 Subject: [PATCH 047/108] Upgrade to Jetty Reactive HTTPClient 4.0.5 Closes gh-41059 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 70690023d5ee..a9cc6d5d8f6e 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -671,7 +671,7 @@ bom { ] } } - library("Jetty Reactive HTTPClient", "4.0.4") { + library("Jetty Reactive HTTPClient", "4.0.5") { group("org.eclipse.jetty") { modules = [ "jetty-reactive-httpclient" From 6e95529eb3287327a26a64da3ec7e27b50ff7b03 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 11 Jun 2024 13:25:10 +0100 Subject: [PATCH 048/108] Upgrade to Jetty 12.0.10 Closes gh-41060 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index a9cc6d5d8f6e..5c9bf2201935 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -678,7 +678,7 @@ bom { ] } } - library("Jetty", "12.0.9") { + library("Jetty", "12.0.10") { group("org.eclipse.jetty.ee10") { imports = [ "jetty-ee10-bom" From 8628fc8831da6d303dae5a92c2751fb83e95bad9 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 11 Jun 2024 13:25:15 +0100 Subject: [PATCH 049/108] Upgrade to jOOQ 3.18.16 Closes gh-41061 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 5c9bf2201935..f600cff083ac 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -697,7 +697,7 @@ bom { ] } } - library("jOOQ", "3.18.15") { + library("jOOQ", "3.18.16") { group("org.jooq") { modules = [ "jooq", From 42de5506c8c73f3b138d0ac6e08705dd30921504 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 11 Jun 2024 13:25:19 +0100 Subject: [PATCH 050/108] Upgrade to Maven Help Plugin 3.4.1 Closes gh-41062 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index f600cff083ac..b3690559473d 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -925,7 +925,7 @@ bom { ] } } - library("Maven Help Plugin", "3.4.0") { + library("Maven Help Plugin", "3.4.1") { group("org.apache.maven.plugins") { plugins = [ "maven-help-plugin" From 428a6248f2586b1117b9c995526dfd10e99f940a Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 11 Jun 2024 13:25:20 +0100 Subject: [PATCH 051/108] Upgrade to Micrometer 1.12.7 Closes gh-41015 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index b3690559473d..ebe9d2219f7e 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -995,7 +995,7 @@ bom { ] } } - library("Micrometer", "1.12.7-SNAPSHOT") { + library("Micrometer", "1.12.7") { considerSnapshots() group("io.micrometer") { modules = [ From 11835d1c967ddcd8c75260af253173bb338e3359 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 11 Jun 2024 13:25:20 +0100 Subject: [PATCH 052/108] Upgrade to Micrometer Tracing 1.2.7 Closes gh-41027 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index ebe9d2219f7e..6fd0ab3cca31 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1008,7 +1008,7 @@ bom { ] } } - library("Micrometer Tracing", "1.2.7-SNAPSHOT") { + library("Micrometer Tracing", "1.2.7") { considerSnapshots() group("io.micrometer") { imports = [ From 20fbe74dfeacecfd324dcb230938f5c8a59dcc55 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 11 Jun 2024 13:25:25 +0100 Subject: [PATCH 053/108] Upgrade to Netty 4.1.111.Final Closes gh-41063 --- spring-boot-project/spring-boot-dependencies/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 6fd0ab3cca31..07da2b5bc061 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1082,7 +1082,7 @@ bom { ] } } - library("Netty", "4.1.110.Final") { + library("Netty", "4.1.111.Final") { group("io.netty") { imports = [ "netty-bom" From d37098153cd92e2a0239db21f11e6bd5ec790e21 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 11 Jun 2024 09:35:59 -0700 Subject: [PATCH 054/108] Polish --- .../flyway/NativeImageResourceProviderCustomizer.java | 5 ++--- .../testing/testcontainers/vanilla/MyIntegrationTests.kt | 2 ++ .../testcontainers/serviceconnections/MyIntegrationTests.kt | 3 +++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProviderCustomizer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProviderCustomizer.java index 3abbee4bf94a..c9e3006b911c 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProviderCustomizer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProviderCustomizer.java @@ -54,16 +54,15 @@ false, new ResourceNameCache(), new LocationScannerCache(), configuration.isFailOnMissingLocations()); } catch (NoSuchMethodError ex) { - // Flyway 10 return createFlyway10Scanner(configuration); } } private static Scanner createFlyway10Scanner(FluentConfiguration configuration) throws LinkageError { try { - Constructor scannerConstructor = Scanner.class.getDeclaredConstructor(Class.class, boolean.class, + Constructor constructor = Scanner.class.getDeclaredConstructor(Class.class, boolean.class, ResourceNameCache.class, LocationScannerCache.class, Configuration.class); - return (Scanner) scannerConstructor.newInstance(JavaMigration.class, false, new ResourceNameCache(), + return (Scanner) constructor.newInstance(JavaMigration.class, false, new ResourceNameCache(), new LocationScannerCache(), configuration); } catch (Exception ex) { diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/vanilla/MyIntegrationTests.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/vanilla/MyIntegrationTests.kt index d15a1bb6c638..e62e5804d7d6 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/vanilla/MyIntegrationTests.kt +++ b/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 { } companion object { + @Container val neo4j = Neo4jContainer("neo4j:5") + } } diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/serviceconnections/MyIntegrationTests.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/serviceconnections/MyIntegrationTests.kt index 6f84114eb201..a5e1071d544e 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/serviceconnections/MyIntegrationTests.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/testing/testcontainers/serviceconnections/MyIntegrationTests.kt @@ -34,9 +34,12 @@ class MyIntegrationTests { } companion object { + @Container @ServiceConnection @JvmStatic val neo4j = Neo4jContainer("neo4j:5"); + } + } From 17adcfc180d9e967592bc9431d41e53bfe9a5e77 Mon Sep 17 00:00:00 2001 From: Piyal Ahmed Date: Tue, 11 Jun 2024 16:18:49 +0600 Subject: [PATCH 055/108] Use constructor rather than Collection.addAll See gh-41053 --- .../boot/autoconfigure/flyway/NativeImageResourceProvider.java | 3 +-- .../boot/test/context/ImportsContextCustomizer.java | 3 +-- .../ServiceConnectionAutoConfigurationRegistrar.java | 3 +-- .../springframework/boot/web/embedded/tomcat/TldPatterns.java | 3 +-- .../boot/web/embedded/tomcat/TomcatEmbeddedContext.java | 3 +-- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProvider.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProvider.java index 63678acf9033..de28c81ba6c3 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProvider.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProvider.java @@ -96,8 +96,7 @@ public Collection getResources(String prefix, String[] suffixe ensureInitialized(); Predicate matchesPrefixAndSuffixes = (locatedResource) -> StringUtils .startsAndEndsWith(locatedResource.resource.getFilename(), prefix, suffixes); - List result = new ArrayList<>(); - result.addAll(this.scanner.getResources(prefix, suffixes)); + List result = new ArrayList<>(this.scanner.getResources(prefix, suffixes)); this.locatedResources.stream() .filter(matchesPrefixAndSuffixes) .map(this::asClassPathResource) diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java index 2c2aa3d73c8f..51517cb961d4 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/ImportsContextCustomizer.java @@ -240,8 +240,7 @@ static class ContextCustomizerKey { this.key = Collections.unmodifiableSet(synthesize(annotations)); } else { - Set key = new HashSet<>(); - key.addAll(determinedImports); + Set key = new HashSet<>(determinedImports); Set componentScanning = annotations.stream() .filter((annotation) -> annotation.getType().equals(ComponentScan.class)) .map(MergedAnnotation::synthesize) diff --git a/spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/service/connection/ServiceConnectionAutoConfigurationRegistrar.java b/spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/service/connection/ServiceConnectionAutoConfigurationRegistrar.java index 8e9be4c32239..d2cd3c498ce2 100644 --- a/spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/service/connection/ServiceConnectionAutoConfigurationRegistrar.java +++ b/spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/service/connection/ServiceConnectionAutoConfigurationRegistrar.java @@ -68,8 +68,7 @@ private void registerBeanDefinitions(ConfigurableListableBeanFactory beanFactory private Set getAnnotations(ConfigurableListableBeanFactory beanFactory, String beanName, BeanDefinition beanDefinition) { - Set annotations = new LinkedHashSet<>(); - annotations.addAll(beanFactory.findAllAnnotationsOnBean(beanName, ServiceConnection.class, false)); + Set annotations = new LinkedHashSet<>(beanFactory.findAllAnnotationsOnBean(beanName, ServiceConnection.class, false)); if (beanDefinition instanceof TestcontainerBeanDefinition testcontainerBeanDefinition) { testcontainerBeanDefinition.getAnnotations() .stream(ServiceConnection.class) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TldPatterns.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TldPatterns.java index 8c1cd0cf3533..a12a448f3a48 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TldPatterns.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TldPatterns.java @@ -195,8 +195,7 @@ final class TldPatterns { static final Set DEFAULT_SCAN; static { - Set scanPatterns = new LinkedHashSet<>(); - scanPatterns.addAll(TOMCAT_SCAN); + Set scanPatterns = new LinkedHashSet<>(TOMCAT_SCAN); DEFAULT_SCAN = Collections.unmodifiableSet(scanPatterns); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedContext.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedContext.java index 48f37a1bb93f..2ddea35a5c33 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedContext.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedContext.java @@ -128,8 +128,7 @@ void setMimeMappings(MimeMappings mimeMappings) { @Override public String[] findMimeMappings() { - List mappings = new ArrayList<>(); - mappings.addAll(Arrays.asList(super.findMimeMappings())); + List mappings = new ArrayList<>(Arrays.asList(super.findMimeMappings())); if (this.mimeMappings != null) { this.mimeMappings.forEach((mapping) -> mappings.add(mapping.getExtension())); } From ecc9a2352d9e132fa56bc61cf0ec813031f1682c Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 11 Jun 2024 09:41:57 -0700 Subject: [PATCH 056/108] Polish "Use constructor rather than Collection.addAll" See gh-41053 --- .../boot/build/toolchain/ToolchainPlugin.java | 3 +-- .../autoconfigure/flyway/NativeImageResourceProvider.java | 2 +- .../ServiceConnectionAutoConfigurationRegistrar.java | 5 +++-- .../org/springframework/boot/context/config/ConfigData.java | 3 +-- .../boot/web/embedded/tomcat/TldPatterns.java | 2 +- .../boot/web/embedded/tomcat/TomcatEmbeddedContext.java | 2 +- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/buildSrc/src/main/java/org/springframework/boot/build/toolchain/ToolchainPlugin.java b/buildSrc/src/main/java/org/springframework/boot/build/toolchain/ToolchainPlugin.java index 82abe1cd65d1..112e276c34b4 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/toolchain/ToolchainPlugin.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/toolchain/ToolchainPlugin.java @@ -71,8 +71,7 @@ private void disableToolchainTasks(Project project) { } private void configureTestToolchain(Project project, ToolchainExtension toolchain) { - List jvmArgs = new ArrayList<>(); - jvmArgs.addAll(toolchain.getTestJvmArgs().getOrElse(Collections.emptyList())); + List jvmArgs = new ArrayList<>(toolchain.getTestJvmArgs().getOrElse(Collections.emptyList())); project.getTasks().withType(Test.class, (test) -> test.jvmArgs(jvmArgs)); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProvider.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProvider.java index de28c81ba6c3..88fde2907c14 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProvider.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/NativeImageResourceProvider.java @@ -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. diff --git a/spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/service/connection/ServiceConnectionAutoConfigurationRegistrar.java b/spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/service/connection/ServiceConnectionAutoConfigurationRegistrar.java index d2cd3c498ce2..ae6c9b10ea43 100644 --- a/spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/service/connection/ServiceConnectionAutoConfigurationRegistrar.java +++ b/spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/service/connection/ServiceConnectionAutoConfigurationRegistrar.java @@ -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,7 +68,8 @@ private void registerBeanDefinitions(ConfigurableListableBeanFactory beanFactory private Set getAnnotations(ConfigurableListableBeanFactory beanFactory, String beanName, BeanDefinition beanDefinition) { - Set annotations = new LinkedHashSet<>(beanFactory.findAllAnnotationsOnBean(beanName, ServiceConnection.class, false)); + Set annotations = new LinkedHashSet<>( + beanFactory.findAllAnnotationsOnBean(beanName, ServiceConnection.class, false)); if (beanDefinition instanceof TestcontainerBeanDefinition testcontainerBeanDefinition) { testcontainerBeanDefinition.getAnnotations() .stream(ServiceConnection.class) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigData.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigData.java index a4a0cfad1d2b..809d1a06c59f 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigData.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigData.java @@ -239,8 +239,7 @@ public Options with(Option option) { } private Options copy(Consumer> processor) { - EnumSet