From a3336b3e29f091bcb294bc10530d6ee374dbb869 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 7 Nov 2019 15:39:06 +0000 Subject: [PATCH 01/65] Start work on Spring Boot 2.3 --- ci/README.adoc | 2 +- ci/pipeline.yml | 6 +++--- pom.xml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ci/README.adoc b/ci/README.adoc index 67ab35e51493..b6c207af4fb8 100644 --- a/ci/README.adoc +++ b/ci/README.adoc @@ -11,7 +11,7 @@ The pipeline can be deployed using the following command: [source] ---- -$ fly -t spring-boot set-pipeline -p spring-boot-2.2.x -c ci/pipeline.yml -l ci/parameters.yml +$ fly -t spring-boot set-pipeline -p spring-boot-2.3.x -c ci/pipeline.yml -l ci/parameters.yml ---- NOTE: This assumes that you have credhub integration configured with the appropriate diff --git a/ci/pipeline.yml b/ci/pipeline.yml index 5866e5728ed6..52c99241ea21 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -77,7 +77,7 @@ resources: repository: ((docker-hub-organization))/spring-boot-ci-image username: ((docker-hub-username)) password: ((docker-hub-password)) - tag: 2.2.x + tag: 2.3.x - name: spring-boot-jdk11-ci-image type: docker-image icon: docker @@ -85,7 +85,7 @@ resources: repository: ((docker-hub-organization))/spring-boot-jdk11-ci-image username: ((docker-hub-username)) password: ((docker-hub-password)) - tag: 2.2.x + tag: 2.3.x - name: spring-boot-jdk13-ci-image type: docker-image icon: docker @@ -93,7 +93,7 @@ resources: repository: ((docker-hub-organization))/spring-boot-jdk13-ci-image username: ((docker-hub-username)) password: ((docker-hub-password)) - tag: 2.2.x + tag: 2.3.x - name: artifactory-repo type: artifactory-resource icon: package-variant diff --git a/pom.xml b/pom.xml index 5a9a184d585a..ed7b7045ef8e 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ Spring Boot Build Spring Boot Build - 2.2.2.BUILD-SNAPSHOT + 2.3.0.BUILD-SNAPSHOT ${basedir} From 0ef4967b9e227da2c4191d52866b1f1cc9330ea6 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 7 Nov 2019 15:55:22 +0000 Subject: [PATCH 02/65] Update Bomr config to look for minor version upgrades --- .bomr/bomr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bomr/bomr.yaml b/.bomr/bomr.yaml index 4fedb4a0cf0b..a9ac945f30f9 100644 --- a/.bomr/bomr.yaml +++ b/.bomr/bomr.yaml @@ -6,7 +6,7 @@ bomr: repository: spring-boot issue-labels: - 'type: dependency-upgrade' - policy: same-minor-version + policy: same-major-version prohibited: - project: derby versions: From 5692960377c64d2d9d55a4add7e142e4f06163ab Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 7 Nov 2019 15:54:55 +0000 Subject: [PATCH 03/65] Upgrade to Assertj 3.14.0 Closes gh-18921 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 006957274d48..7633c482d74e 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -39,7 +39,7 @@ 1.9.76 2.10.1 1.9.4 - 3.13.2 + 3.14.0 4.0.6 4.0.1 2.1.4 From 870aa86eb98926f7b60af36598db49e4241e81c2 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 7 Nov 2019 15:54:56 +0000 Subject: [PATCH 04/65] Upgrade to Hamcrest 2.2 Closes gh-18922 --- .../cli/command/install/GroovyGrabDependencyResolverTests.java | 2 +- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/GroovyGrabDependencyResolverTests.java b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/GroovyGrabDependencyResolverTests.java index c82ea3ba8483..49851cc01de0 100644 --- a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/GroovyGrabDependencyResolverTests.java +++ b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/install/GroovyGrabDependencyResolverTests.java @@ -115,7 +115,7 @@ void resolveMultipleArtifacts() throws Exception { .resolve(Arrays.asList("junit:junit:4.11", "commons-logging:commons-logging:1.1.3")); assertThat(resolved).hasSize(4); assertThat(getNames(resolved)).containsOnly("junit-4.11.jar", "commons-logging-1.1.3.jar", - "hamcrest-core-2.1.jar", "hamcrest-2.1.jar"); + "hamcrest-core-2.2.jar", "hamcrest-2.2.jar"); } Set getNames(Collection files) { diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 7633c482d74e..c9c770aadb25 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -69,7 +69,7 @@ 2.5.8 2.8.6 1.4.200 - 2.1 + 2.2 3.12.4 1.3.2 5.4.8.Final From 506109987d67c3247b0c339cc74a94ac48b7e900 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 7 Nov 2019 15:54:58 +0000 Subject: [PATCH 05/65] Upgrade to Hibernate Validator 6.1.0.Final Closes gh-18923 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index c9c770aadb25..45e5cd8fe8c9 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -73,7 +73,7 @@ 3.12.4 1.3.2 5.4.8.Final - 6.0.18.Final + 6.1.0.Final 3.4.1 2.5.0 2.36.0 From 4e6f56d1f4beeb62fba2f5edc57cb581fdb7251b Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 7 Nov 2019 15:54:59 +0000 Subject: [PATCH 06/65] Upgrade to Influxdb Java 2.16 Closes gh-18924 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 45e5cd8fe8c9..8c6c84291419 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -81,7 +81,7 @@ 4.5.10 4.4.12 9.4.16.Final - 2.15 + 2.16 2.10.0 ${jackson.version} From 41426a38160691d96766b601574a3bbd454bd373 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 7 Nov 2019 15:55:00 +0000 Subject: [PATCH 07/65] Upgrade to Mariadb 2.5.1 Closes gh-18925 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 8c6c84291419..448154ae25c8 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -150,7 +150,7 @@ 2.12.1 1.2.3 1.18.10 - 2.4.4 + 2.5.1 1.3.1 1.9.12 3.1.0 From 611dfec43379d170b0b4c1955fcd84d1d01154e8 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 7 Nov 2019 15:55:02 +0000 Subject: [PATCH 08/65] Upgrade to Pooled Jms 1.1.0 Closes gh-18926 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 448154ae25c8..99cede9d87dd 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -165,7 +165,7 @@ 1.1.0 19.3.0.0 3.14.4 - 1.0.6 + 1.1.0 42.2.8 0.7.0 2.3.2 From d841a91fb5f1d15833d0bb017f9e3b291eb528d5 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 7 Nov 2019 15:55:03 +0000 Subject: [PATCH 09/65] Upgrade to Webjars Locator Core 0.42 Closes gh-18927 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 99cede9d87dd..101e373b69be 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -211,7 +211,7 @@ 4.0.12 2.0.27.Final 3325375 - 0.41 + 0.42 1.6.3 2.6.3 From 913e4796ee4e71a21fbe43a426dd50f6ad2ec801 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 7 Nov 2019 15:55:05 +0000 Subject: [PATCH 10/65] Upgrade to Maven Assembly Plugin 3.2.0 Closes gh-18928 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 101e373b69be..cce7f63190b8 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -219,7 +219,7 @@ 1.6.0 3.0.1 1.8 - 3.1.1 + 3.2.0 3.1.0 3.8.1 3.1.1 From 713391238165ba03045a81a28d1ee149431e9060 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 7 Nov 2019 15:55:07 +0000 Subject: [PATCH 11/65] Upgrade to Maven Jar Plugin 3.2.0 Closes gh-18929 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index cce7f63190b8..47c4bea038dd 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -229,7 +229,7 @@ 2.5.2 3.2.1 3.2.0 - 3.1.2 + 3.2.0 3.1.1 3.1.0 3.2.1 From dbef4708336b589632f39bacafc0da3a692556d2 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 7 Nov 2019 15:55:08 +0000 Subject: [PATCH 12/65] Upgrade to Maven Source Plugin 3.2.0 Closes gh-18930 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 47c4bea038dd..c9a17e3b62e1 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -234,7 +234,7 @@ 3.1.0 3.2.1 3.8.2 - 3.1.0 + 3.2.0 2.22.2 3.2.3 2.7 From a5a36a1ea748e0e8bbaf92475823a2acbf3ab884 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 20 Nov 2019 11:52:41 +0100 Subject: [PATCH 13/65] Start building against Reactor Dysprosium-SR2 snapshots See gh-19077 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index f1b4a4674c51..fe645ad6fe36 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -171,7 +171,7 @@ 2.3.2 4.2.1 5.7.3 - Dysprosium-SR1 + Dysprosium-BUILD-SNAPSHOT 3.3.0 1.0.3 1.0.0-RC5 From 744f9f9e09862b0a06321a2f8ab2ff43e6a11a78 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 20 Nov 2019 11:53:07 +0100 Subject: [PATCH 14/65] Start building against Spring Framework 5.2.2 snapshots See gh-19076 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index fe645ad6fe36..03d7ddd335aa 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -189,7 +189,7 @@ 4.2.0.RELEASE 2.0.6.RELEASE Moore-SR1 - 5.2.1.RELEASE + 5.2.2.BUILD-SNAPSHOT 1.0.1.RELEASE 5.2.1.RELEASE 2.3.3.RELEASE From 4b63a8cdea389dfea935214b71fbe76ddb7ef6e5 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 20 Nov 2019 11:53:38 +0100 Subject: [PATCH 15/65] Start building against Spring Data Moore-SR3 snapshots See gh-19075 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 03d7ddd335aa..6dbff6c54f49 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -188,7 +188,7 @@ 2.2.1.RELEASE 4.2.0.RELEASE 2.0.6.RELEASE - Moore-SR1 + Moore-BUILD-SNAPSHOT 5.2.2.BUILD-SNAPSHOT 1.0.1.RELEASE 5.2.1.RELEASE From 3e2454f8c433cf0e522a4d55bec4ff1f921b0970 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 19 Nov 2019 16:25:24 +0000 Subject: [PATCH 16/65] Replace the Maven Plugin's site with Asciidoctor documentation Closes gh-19080 Co-authored-by: Stephane Nicoll --- spring-boot-project/spring-boot-docs/pom.xml | 4 +- .../spring-boot-parent/pom.xml | 4 +- .../spring-boot-maven-plugin/pom.xml | 264 ++++++++++-- .../src/main/asciidoc/build-info.adoc | 41 ++ .../src/main/asciidoc/getting-started.adoc | 7 + .../src/main/asciidoc/help.adoc | 5 + .../src/main/asciidoc/index.adoc | 23 + .../src/main/asciidoc/integration-tests.adoc | 179 ++++++++ .../src/main/asciidoc/packaging.adoc | 395 ++++++++++++++++++ .../src/main/asciidoc/running.adoc | 241 +++++++++++ .../groovy/generateGoalsDocumentation.groovy | 129 ++++++ .../boot/maven/RepackageMojo.java | 2 +- 12 files changed, 1255 insertions(+), 39 deletions(-) create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/build-info.adoc create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/getting-started.adoc create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/help.adoc create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/index.adoc create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/integration-tests.adoc create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/packaging.adoc create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/running.adoc create mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/groovy/generateGoalsDocumentation.groovy diff --git a/spring-boot-project/spring-boot-docs/pom.xml b/spring-boot-project/spring-boot-docs/pom.xml index d8600679a805..69392ae8fdfe 100644 --- a/spring-boot-project/spring-boot-docs/pom.xml +++ b/spring-boot-project/spring-boot-docs/pom.xml @@ -1250,8 +1250,8 @@ org.springframework.boot spring-boot-maven-plugin ${revision} - site - jar + docs + zip ${project.build.directory}/contents/maven-plugin diff --git a/spring-boot-project/spring-boot-parent/pom.xml b/spring-boot-project/spring-boot-parent/pom.xml index 7fcc10524a53..f22e5e0ce815 100644 --- a/spring-boot-project/spring-boot-parent/pom.xml +++ b/spring-boot-project/spring-boot-parent/pom.xml @@ -30,8 +30,8 @@ 1.1.1 1.3-groovy-2.5 0.3.0.RELEASE - 0.1.3.RELEASE - https://repo.spring.io/release/io/spring/docresources/spring-doc-resources/${spring-doc-resources.version}/spring-doc-resources-${spring-doc-resources.version}.zip + 0.1.4.BUILD-20191119.185717-2 + https://repo.spring.io/snapshot/io/spring/docresources/spring-doc-resources/0.1.4.BUILD-SNAPSHOT/spring-doc-resources-${spring-doc-resources.version}.zip 1.12.2 6.14.3 diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/pom.xml b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/pom.xml index d762ca4d46c9..10d5f0dc7b33 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/pom.xml +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/pom.xml @@ -14,6 +14,7 @@ ${basedir}/../../.. 3.3.9 + ${project.build.directory}/refdocs/ ${git.url} @@ -204,18 +205,6 @@ - - org.apache.maven.plugins - maven-site-plugin - - - generate-site - - jar - - - - org.apache.maven.plugins maven-invoker-plugin @@ -249,6 +238,29 @@ org.apache.maven.plugins maven-antrun-plugin + + + ant-contrib + ant-contrib + 1.0b3 + + + ant + ant + + + + + org.apache.ant + ant-nodeps + 1.8.1 + + + org.tigris.antelope + antelopetasks + 3.2.10 + + cleanup-local-integration-repo @@ -267,37 +279,221 @@ + + set-up-maven-properties + prepare-package + + run + + + true + + + + + + + + + + + + + + + package-docs-zip + package + + run + + + + + + + + + + + + + - - - - - org.apache.maven.plugins - maven-plugin-plugin + com.googlecode.maven-download-plugin + download-maven-plugin + + + unpack-doc-resources + generate-resources + + wget + + + ${spring-doc-resources.url} + true + ${refdocs.build.directory} + + + - org.apache.maven.plugins - maven-project-info-reports-plugin - 2.9 - - - - index - cim - issue-tracking - license - scm - - - + org.codehaus.gmavenplus + gmavenplus-plugin + + + + execute + + prepare-package + + + + + + + + + + org.codehaus.groovy + groovy-ant + ${groovy.version} + + + org.codehaus.groovy + groovy-xml + ${groovy.version} + + + + + org.asciidoctor + asciidoctor-maven-plugin + + + generate-html-documentation + prepare-package + + process-asciidoc + + + html5 + ${project.build.directory}/generated-docs/reference/html + highlight.js + book + + js/highlight + github + true + ./images + font + css/ + spring.css + warn + + + true + + DEBUG + + + + + + generate-pdf-documentation + prepare-package + + process-asciidoc + + + pdf + ${project.build.directory}/generated-docs/reference/pdf + + + - true + ${refdocs.build.directory} + index.adoc + + ${project.version} + ${build-helper-maven-plugin.version} + ${maven-failsafe-plugin.version} + ${maven-jar-plugin.version} + ${project.basedir}/target/generated-resources + + + + org.asciidoctor + asciidoctorj-pdf + 1.5.0-alpha.18 + + + + + org.apache.maven.plugins + maven-resources-plugin + + + copy-asciidoc-resources + generate-resources + + copy-resources + + + ${refdocs.build.directory} + + + src/main/asciidoc + false + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + attach-zip + + attach-artifact + + + + + ${project.build.directory}/${project.artifactId}-${project.version}-docs.zip + zip + docs + + + + + - + diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/build-info.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/build-info.adoc new file mode 100644 index 000000000000..487b24d61c46 --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/build-info.adoc @@ -0,0 +1,41 @@ +[[build-info]] +== Integrating with Actuator +Spring Boot Actuator displays build-related information if a `META-INF/build-info.properties` file is present. +The `build-info` goal generates such file with the coordinates of the project and the build time. +It also allows you to add an arbitrary number of additional properties, as shown in the following example: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + + + org.springframework.boot + spring-boot-maven-plugin + {version} + + + + build-info + + + + UTF-8 + UTF-8 + ${maven.compiler.source} + ${maven.compiler.target} + + + + + + + + +---- + +This configuration will generate a `build-info.properties` at the expected location with four additional keys. +Note that `maven.compiler.source` and `maven.compiler.target` are expected to be regular properties available in the project. +They will be interpolated as you would expect. + +include::{generated-resources-root}/goals/build-info.adoc[leveloffset=+1] diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/getting-started.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/getting-started.adoc new file mode 100644 index 000000000000..6501051115bb --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/getting-started.adoc @@ -0,0 +1,7 @@ +[[getting-started]] +== Getting started + +The Spring Boot Plugin has the following goals: + +include::{generated-resources-root}/goals/overview.adoc[] + diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/help.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/help.adoc new file mode 100644 index 000000000000..49d5452ea4ed --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/help.adoc @@ -0,0 +1,5 @@ +[[help]] +== Help information +The `help` goal is a standard goal that displays information on the capabilities of the plugin. + +include::{generated-resources-root}/goals/help.adoc[leveloffset=+1] diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/index.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/index.adoc new file mode 100644 index 000000000000..f5a0cfd84118 --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/index.adoc @@ -0,0 +1,23 @@ += Spring Boot Maven Plugin Documentation +Stephane Nicoll, Andy Wilkinson +:doctype: book +:toc: left +:toclevels: 4 +:source-highlighter: prettify +:numbered: +:icons: font +:hide-uri-scheme: +:docinfo: shared,private + +[[introduction]] +== Introduction + +The Spring Boot Maven Plugin provides Spring Boot support in https://maven.org[Apache Maven]. +It allows you to package executable jar or war archives, run Spring Boot applications, generate build information and start your Spring Boot application prior to running integration tests. + +include::getting-started.adoc[] +include::packaging.adoc[] +include::running.adoc[] +include::integration-tests.adoc[] +include::build-info.adoc[] +include::help.adoc[] \ No newline at end of file diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/integration-tests.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/integration-tests.adoc new file mode 100644 index 000000000000..c0ed01fd3712 --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/integration-tests.adoc @@ -0,0 +1,179 @@ +[[integration-tests]] +== Running Integration tests + +While you may start your Spring Boot application very easily from your test (or test suite) itself, it may be desirable to handle that in the build itself. +To make sure that the lifecycle of your Spring Boot application is properly managed around your integration tests, you can use the `start` and `stop` goals, as shown in the following example: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + + org.springframework.boot + spring-boot-maven-plugin + {version} + + + pre-integration-test + + start + + + + post-integration-test + + stop + + + + + + +---- + +Such setup can now use the https://maven.apache.org/surefire/maven-failsafe-plugin[failsafe-plugi to run your integration tests as you would expect. + +You could also configure a more advanced setup to skip the integration tests when a specific property has been set, see <>. + +include::{generated-resources-root}/goals/start.adoc[leveloffset=+1] + +include::{generated-resources-root}/goals/stop.adoc[leveloffset=+1] + + +[[integration-tests-example]] +=== Examples + + + +[[integration-tests-example-random-port]] +==== Random Port for Integration Tests +One nice feature of the Spring Boot test integration is that it can allocate a free port for the web application. +When the `start` goal of the plugin is used, the Spring Boot application is started separately, making it difficult to pass the actual port to the integration test itself. + +The example below showcases how you could achieve the same feature using the https://www.mojohaus.org/build-helper-maven-plugin[Build Helper Maven Plugin]: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + + + org.codehaus.mojo + build-helper-maven-plugin + {build-helper-maven-plugin-version} + + + reserve-tomcat-port + + reserve-network-port + + process-resources + + + tomcat.http.port + + + + + + + org.springframework.boot + spring-boot-maven-plugin + {version} + + + pre-integration-test + + start + + + + --server.port=${tomcat.http.port} + + + + + post-integration-test + + stop + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + {maven-failsafe-plugin-version} + + + ${tomcat.http.port} + + + + + + +---- + +You can now retrieve the `test.server.port` system property in any of your integration test to create a proper `URL` to the server. + + + +[[integration-tests-example-skip]] +==== Skip Integration Tests +The `skip` property allows to skip the execution of the Spring Boot maven plugin altogether. + +This example shows how you can skip integration tests with a command-line property and still make sure that the `repackage` goal runs: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + false + + + + + org.springframework.boot + spring-boot-maven-plugin + {version} + + + pre-integration-test + + start + + + ${skip.it} + + + + post-integration-test + + stop + + + ${skip.it} + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + {maven-failsafe-plugin-version} + + ${skip.it} + + + + + +---- + +By default, the integration tests will run but this setup allows you to easily disable them on the command-line as follows: + +[indent=0] +---- + $ mvn verify -Dskip.it=true +---- diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/packaging.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/packaging.adoc new file mode 100644 index 000000000000..495dca330f79 --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/packaging.adoc @@ -0,0 +1,395 @@ +[[repackage]] +== Packaging executable archives + +The plugin can create executable archives (jar files and war files) that contain all of an application's dependencies and can then be run with `java -jar`. + +Packaging an executable archive is performed by the `repackage` goal, as shown in the following example: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + + org.springframework.boot + spring-boot-maven-plugin + {version} + + + + repackage + + + + + + +---- + +TIP: If you are using `spring-boot-starter-parent`, such execution is already pre-configured with a `repackage` execution id so that only the plugin definition should be added. + +The example above repackages a jar or war that is built during the package phase of the Maven lifecycle, including any `provided` dependencies that are defined in the project. +If some of these dependencies need to be excluded, you can use one of the exclude options, see the <> for more details. + +NOTE: The `outputFileNameMapping` feature of the `maven-war-plugin` is currently not supported. + +Devtools is automatically excluded by default (you can control that using the `excludeDevtools` property). +In order to make that work with `war` packaging, the `spring-boot-devtools` dependency must be set as `optional` or with the `provided` scope. + +The original (i.e. non executable) artifact is renamed to `.original` by default but it is also possible to keep the original artifact using a custom classifier. + +The plugin rewrites your manifest, and in particular it manages the "Main-Class" and "Start-Class" entries, so if the defaults don't work you have to configure those there (not in the jar plugin). +The "Main-Class" in the manifest is actually controlled by the "layout" property of the Spring Boot plugin, as shown in the following example: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + + org.springframework.boot + spring-boot-maven-plugin + {version} + + ${start.class} + ZIP + + + + + repackage + + + + + + +---- + +The `layout` property defaults to a guess based on the archive type (`jar` or `war`). The following layouts are available: + +* `JAR`: regular executable JAR layout. +* `WAR`: executable WAR layout. `provided` dependencies are placed in `WEB-INF/lib-provided` to avoid any clash when the `war` is deployed in a servlet container. +* `ZIP` (alias to `DIR`): similar to the `JAR` layout using `PropertiesLauncher`. +* `NONE`: Bundle all dependencies and project resources. Does not bundle a bootstrap loader. + +include::{generated-resources-root}/goals/repackage.adoc[leveloffset=+1] + +[[repackage-examples]] +=== Examples + +[[repackage-example-custom-classifier]] +==== Custom Classifier +By default, the `repackage` goal replaces the original artifact with the repackaged one. +That is a sane behavior for modules that represent an application but if your module is used as a dependency of another module, you need to provide a classifier for the repackaged one. +The reason for that is that application classes are packaged in `BOOT-INF/classes` so that the dependent module cannot load a repackaged jar's classes. + +If that is the case or if you prefer to keep the original artifact and attach the repackaged one with a different classifier, configure the plugin as shown in the following example: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + + + org.springframework.boot + spring-boot-maven-plugin + {version} + + + repackage + + repackage + + + exec + + + + + + + +---- + +If you are using `spring-boot-starter-parent`, the `repackage` goal is executed automatically in an execution with id `repackage`. +In that setup, only the configuration should be specified, as shown in the following example: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + + + org.springframework.boot + spring-boot-maven-plugin + + + repackage + + exec + + + + + + + +---- + +This configuration will generate two artifacts: the original one and the repackaged counter part produced by the repackage goal. +Both will be installed/deployed transparently. + +You can also use the same configuration if you want to repackage a secondary artifact the same way the main artifact is replaced. +The following configuration installs/deploys a single `task` classified artifact with the repackaged application: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + + + org.apache.maven.plugins + maven-jar-plugin + {maven-jar-plugin-version} + + + + jar + + package + + task + + + + + + org.springframework.boot + spring-boot-maven-plugin + {version} + + + repackage + + repackage + + + task + + + + + + + +---- + +As both the `maven-jar-plugin` and the `spring-boot-maven-plugin` runs at the same phase, it is important that the jar plugin is defined first (so that it runs before the repackage goal). +Again, if you are using `spring-boot-starter-parent`, this can be simplified as follows: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + + + org.apache.maven.plugins + maven-jar-plugin + + + default-jar + + task + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + repackage + + task + + + + + + + +---- + + + +[[repackage-example-custom-name]] +==== Custom Name +If you need the repackaged jar to have a different local name than the one defined by the `artifactId` attribute of the project, simply use the standard `finalName`, as shown in the following example: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + my-app + + + org.springframework.boot + spring-boot-maven-plugin + {version} + + + repackage + + repackage + + + + + + + +---- + +This configuration will generate the repackaged artifact in `target/my-app.jar`. + + + +[[repackage-example-local-artifact]] +==== Local Repackaged Artifact +By default, the `repackage` goal replaces the original artifact with the executable one. +If you need to only deploy the original jar and yet be able to run your app with the regular file name, configure the plugin as follows: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + + + org.springframework.boot + spring-boot-maven-plugin + {version} + + + repackage + + repackage + + + false + + + + + + + +---- + +This configuration generates two artifacts: the original one and the executable counter part produced by the `repackage` goal. +Only the original one will be installed/deployed. + + + +[[repackage-example-custom-layout]] +==== Custom Layout +Spring Boot repackages the jar file for this project using a custom layout factory defined in the additional jar file, provided as a dependency to the build plugin: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + + + org.springframework.boot + spring-boot-maven-plugin + {version} + + + repackage + + repackage + + + + value + + + + + + + com.example + custom-layout + 0.0.1.BUILD-SNAPSHOT + + + + + + +---- + +The layout factory is provided as an implementation of `LayoutFactory` (from `spring-boot-loader-tools`) explicitly specified in the pom. +If there is only one custom `LayoutFactory` on the plugin classpath and it is listed in `META-INF/spring.factories` then it is unnecessary to explicitly set it in the plugin configuration. + +Layout factories are always ignored if an explicit <> is set. + + + +[[repackage-example-exclude-dependency]] +==== Dependency Exclusion +By default, both the `repackage` and the `run` goals will include any `provided` dependencies that are defined in the project. +A Spring Boot project should consider `provided` dependencies as "container" dependencies that are required to run the application. + +Some of these dependencies may not be required at all and should be excluded from the executable jar. +For consistency, they should not be present either when running the application. + +There are two ways one can exclude a dependency from being packaged/used at runtime: + +* Exclude a specific artifact identified by `groupId` and `artifactId`, optionally with a `classifier` if needed. +* Exclude any artifact belonging to a given `groupId`. + +The following example excludes `com.foo:bar`, and only that artifact: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + + + org.springframework.boot + spring-boot-maven-plugin + {version} + + + + com.foo + bar + + + + + + + +---- + +This example excludes any artifact belonging to the `com.foo` group: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + + + org.springframework.boot + spring-boot-maven-plugin + {version} + + com.foo + + + + + +---- diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/running.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/running.adoc new file mode 100644 index 000000000000..59f5918eed3f --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/running.adoc @@ -0,0 +1,241 @@ +[[run]] +== Running your application with Maven + +The plugin includes a run goal which can be used to launch your application from the command line, as shown in the following example: + +[indent=0] +---- + $ mvn spring-boot:run +---- + +By default the application is executed in a forked process and setting properties on the command-line will not affect the application. +If you need to specify some JVM arguments (i.e. for debugging purposes), you can use the `jvmArguments` parameter, see <> for more details. +There is also explicit support for <> and <>. + +As enabling a profile is quite common, there is dedicated `profiles` property that offers a shortcut for `-Dspring-boot.run.jvmArguments="-Dspring.profiles.active=dev"`, see <>. + +Although this is not recommended, it is possible to execute the application directly from the Maven JVM by disabling the `fork` property. +Doing so means that the `jvmArguments`, `systemPropertyVariables`, `environmentVariables` and `agents` options are ignored. + +Spring Boot `devtools` is a module to improve the development-time experience when working on Spring Boot applications. +To enable it, just add the following dependency to your project: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + org.springframework.boot + spring-boot-devtools + {version} + true + + +---- + +When `devtools` is running, it detects change when you recompile your application and automatically refreshes it. +This works for not only resources but code as well. +It also provides a LiveReload server so that it can automatically trigger a browser refresh whenever things change. + +Devtools can also be configured to only refresh the browser whenever a static resource has changed (and ignore any change in the code). +Just include the following property in your project: + +[source,properties,indent=0] +---- + spring.devtools.remote.restart.enabled=false +---- + +Prior to `devtools`, the plugin supported hot refreshing of resources by default which has now be disabled in favour of the solution described above. +You can restore it at any time by configuring your project: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + + org.springframework.boot + spring-boot-maven-plugin + {version} + + true + + + + +---- + +When `addResources` is enabled, any `src/main/resources` folder will be added to the application classpath when you run the application and any duplicate found in `target/classes` will be removed. +This allows hot refreshing of resources which can be very useful when developing web applications. +For example, you can work on HTML, CSS or JavaScript files and see your changes immediately without recompiling your application. +It is also a helpful way of allowing your front end developers to work without needing to download and install a Java IDE. + +NOTE: A side effect of using this feature is that filtering of resources at build time will not work. + +In order to be consistent with the `repackage` goal, the `run` goal builds the classpath in such a way that any dependency that is excluded in the plugin's configuration gets excluded from the classpath as well. +For more details, see <>. + +Sometimes it is useful to include test dependencies when running the application. +For example, if you want to run your application in a test mode that uses stub classes. +If you wish to do this, you can set the `useTestClasspath` parameter to true. +Note that this is only applied when you run an application: the `repackage` goal will not add test dependencies to the resulting JAR/WAR. + +include::{generated-resources-root}/goals/run.adoc[leveloffset=+1] + +[[run-examples]] +=== Examples + + + +[[run-example-debug]] +==== Debug the Application +By default, the `run` goal runs your application in a forked process. +If you need to debug it, you should add the necessary JVM arguments to enable remote debugging. +The following configuration suspend the process until a debugger has joined on port 5005: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + + + org.springframework.boot + spring-boot-maven-plugin + {version} + + + -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 + + + + + + +---- + +These arguments can be specified on the command line as well, make sure to wrap that properly, that is: + +[indent=0] +---- + $ mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" +---- + + + +[[run-example-system-properties]] +==== Using System Properties +System properties can be specified using the `systemPropertyVariables` attribute. +The following example sets `property1` to `test` and `property2` to 42: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + + 42 + + + + org.springframework.boot + spring-boot-maven-plugin + {version} + + + test + ${my.value} + + + + + + +---- + +If the value is empty or not defined (i.e. `), the system property is set with an empty String as the value. +Maven trims values specified in the pom so it is not possible to specify a System property which needs to start or end with a space via this mechanism: consider using `jvmArguments` instead. + +Any String typed Maven variable can be passed as system properties. +Any attempt to pass any other Maven variable type (e.g. a `List` or a `URL` variable) will cause the variable expression to be passed literally (unevaluated). + +The `jvmArguments` parameter takes precedence over system properties defined with the mechanism above. +In the following example, the value for `property1` is `overridden`: + +[indent=0] +---- + $ mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dproperty1=overridden" +---- + + + +[[run-example-environment-variables]] +==== Using Environment Variables +Environment variables can be specified using the `environmentVariables` attribute. +The following example sets the 'ENV1', 'ENV2', 'ENV3', 'ENV4' env variables: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + + + org.springframework.boot + spring-boot-maven-plugin + {version} + + + 5000 + Some Text + + + + + + + + +---- + +If the value is empty or not defined (i.e. `), the env variable is set with an empty String as the value. +Maven trims values specified in the pom so it is not possible to specify an env variable which needs to start or end with a space. + +Any String typed Maven variable can be passed as system properties. +Any attempt to pass any other Maven variable type (e.g. a `List` or a `URL` variable) will cause the variable expression to be passed literally (unevaluated). + +Environment variables defined this way take precedence over existing values. + + + +[[run-example-active-profiles]] +==== Specify Active Profiles +The active profiles to use for a particular application can be specified using the `profiles` argument. + +The following configuration enables the `foo` and `bar` profiles: + +[source,xml,indent=0,subs="verbatim,attributes"] +---- + + + + + org.springframework.boot + spring-boot-maven-plugin + {version} + + + foo + bar + + + + + + +---- + +The profiles to enable can be specified on the command line as well, make sure to separate them with a comma, as shown in the following example: + +[indent=0] +---- + $ mvn spring-boot:run -Dspring-boot.run.profiles=foo,bar +---- + + + diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/groovy/generateGoalsDocumentation.groovy b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/groovy/generateGoalsDocumentation.groovy new file mode 100644 index 000000000000..a7542748de85 --- /dev/null +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/groovy/generateGoalsDocumentation.groovy @@ -0,0 +1,129 @@ +import groovy.util.XmlSlurper + +private String format(String input) { + input.replace("", "`") + .replace("", "`") + .replace("<", "<") + .replace(">", ">") + .replace("
", " ") + .replace("\n", " ") + .replace(""", '"') + .replaceAll('\\{@code (.*?)\\}', '`$1`') + .replaceAll('\\{@link (.*?)\\}', '`$1`') + .replaceAll('\\{@literal (.*?)\\}', '`$1`') + .replaceAll('(.*?)', '\$1[\$2]') +} + +private writeParametersTable(PrintWriter writer, def goal, def parameters, def configuration) { + writer.println '[cols="3,2,3"]' + writer.println '|===' + writer.println '| Name | Type | Default' + writer.println() + parameters.each { parameter -> + def name = parameter.name.text() + writer.println("| <>") + def type = parameter.type.text() + if (type.lastIndexOf('.') >= 0) { + type = type.substring(type.lastIndexOf('.') + 1) + } + writer.println("| `$type`") + def defaultValue = "${configuration[name].@'default-value'}" + if (defaultValue) { + writer.println("| `$defaultValue`") + } + else { + writer.println("|") + } + writer.println() + } + writer.println '|===' +} + +private writeParameterDetails(PrintWriter writer, def parameters, def configuration, def sectionId) { + parameters.each { parameter -> + def name = parameter.name.text() + writer.println "[[$sectionId-$name]]" + writer.println "==== `$name`" + writer.println(format(parameter.description.text())) + writer.println() + writer.println '[cols="10h,90"]' + writer.println '|===' + writer.println() + writer.println '| Name' + writer.println "| `$name`" + writer.println '| Type' + def type = parameter.type.text() + if (type.lastIndexOf('.') >= 0) { + type = type.substring(type.lastIndexOf('.') + 1) + } + writer.println("| `$type`") + def defaultValue = "${configuration[name].@'default-value'}" + if (defaultValue) { + writer.println '| Default value' + writer.println("| `$defaultValue`") + } + def userProperty = "${configuration[name].text().replace('${', '`').replace('}', '`')}" + writer.println '| User property' + userProperty ? writer.println("| ${userProperty}") : writer.println("|") + writer.println '| Since' + def since = parameter.since.text() + since ? writer.println("| `${since}`") : writer.println("|") + writer.println '| Required' + writer.println "| ${parameter.required.text()}" + writer.println() + writer.println '|===' + } +} + +def plugin = new XmlSlurper().parse("${project.build.outputDirectory}/META-INF/maven/plugin.xml" as File) +String goalPrefix = plugin.goalPrefix.text() +File goalsDir = new File(project.build.directory, "generated-resources/goals/") +goalsDir.mkdirs() + +new File(goalsDir, "overview.adoc").withPrintWriter { writer -> + writer.println '[cols="1,3"]' + writer.println '|===' + writer.println '| Goal | Description' + writer.println() + plugin.mojos.mojo.each { mojo -> + def goal = mojo.goal.text() + writer.println "| <>" + writer.println "| ${format(mojo.description.text())}" + writer.println() + } + writer.println '|===' +} + +plugin.mojos.mojo.each { mojo -> + String goal = mojo.goal.text() + new File(goalsDir, "${goal}.adoc").withPrintWriter { writer -> + def sectionId = "goals-$goal" + writer.println() + writer.println("[[$sectionId]]") + writer.println("== `$goalPrefix:$goal`") + writer.println("`${plugin.groupId.text()}:${plugin.artifactId.text()}:${plugin.version.text()}:${mojo.goal.text()}`") + writer.println() + writer.println(format(mojo.description.text())) + writer.println() + def parameters = mojo.parameters.parameter.findAll { it.editable.text() == 'true' } + def requiredParameters = parameters.findAll { it.required.text() == 'true' } + if (requiredParameters.size()) { + writer.println("[[$sectionId-parameters-required]]") + writer.println("=== Required parameters") + writeParametersTable(writer, goal, requiredParameters, mojo.configuration) + writer.println() + } + def optionalParameters = parameters.findAll { it.required.text() == 'false' } + if (optionalParameters.size()) { + writer.println("[[$sectionId-parameters-optional]]") + writer.println("=== Optional parameters") + writeParametersTable(writer, goal, optionalParameters, mojo.configuration) + writer.println() + } + def detailsSectionId = "$sectionId-parameters-details" + writer.println("[[$detailsSectionId]]") + writer.println("=== Parameter details") + writeParameterDetails(writer, parameters, mojo.configuration, detailsSectionId) + writer.println() + } +} diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java index d57f51d3db4b..0423035ff64e 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java @@ -112,7 +112,7 @@ public class RepackageMojo extends AbstractDependencyFilterMojo { * attached as a supplemental artifact with that classifier. Attaching the artifact * allows to deploy it alongside to the original one, see the maven documentation for more details. + * >the Maven documentation for more details. * @since 1.0.0 */ @Parameter From 204a552c35c8f5af9abbbb73dd247a40d6858601 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 21 Nov 2019 13:37:37 +0000 Subject: [PATCH 17/65] Update links from main reference docs to Maven Plugin docs See gh-19080 --- .../spring-boot-docs/src/main/asciidoc/attributes.adoc | 2 +- .../spring-boot-docs/src/main/asciidoc/build-tool-plugins.adoc | 2 +- .../spring-boot-docs/src/main/asciidoc/howto.adoc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/attributes.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/attributes.adoc index 3d5152a9692d..16bca947738d 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/attributes.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/attributes.adoc @@ -29,7 +29,7 @@ :spring-boot-master-code: https://github.com/{github-repo}/tree/master :spring-boot-current-docs: https://docs.spring.io/spring-boot/docs/current/reference :spring-boot-actuator-restapi: https://docs.spring.io/spring-boot/docs/{spring-boot-version}/actuator-api/ -:spring-boot-maven-plugin-docs: https://docs.spring.io/spring-boot/docs/{spring-boot-version}/maven-plugin/ +:spring-boot-maven-plugin-docs: https://docs.spring.io/spring-boot/docs/{spring-boot-version}/maven-plugin/html/ :spring-boot-gradle-plugin-docs: https://docs.spring.io/spring-boot/docs/{spring-boot-version}/gradle-plugin/reference/html/ :spring-boot-gradle-plugin-pdfdocs: https://docs.spring.io/spring-boot/docs/{spring-boot-version}/gradle-plugin/reference/pdf/spring-boot-gradle-plugin-reference.pdf :spring-boot-gradle-plugin-api: https://docs.spring.io/spring-boot/docs/{spring-boot-version}/gradle-plugin/reference/api/ diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/build-tool-plugins.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/build-tool-plugins.adoc index a25d94d13666..e85267f5d078 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/build-tool-plugins.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/build-tool-plugins.adoc @@ -14,7 +14,7 @@ If you are just getting started, you might want to read "`< ---- -TIP: See the {spring-boot-maven-plugin-docs}[Spring Boot Maven Plugin documentation] for more details. +TIP: See the {spring-boot-maven-plugin-docs}/#build-info[Spring Boot Maven Plugin documentation] for more details. The following example does the same with Gradle: From a76a864270ef47784ddeb703f4366409736bd4b3 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 21 Nov 2019 17:43:50 +0100 Subject: [PATCH 18/65] Polish "Replace the Maven Plugin's site with Asciidoctor documentation" See gh-19080 --- .../boot/maven/RepackageMojo.java | 2 +- .../springframework/boot/maven/RunMojo.java | 2 +- .../springframework/boot/maven/StartMojo.java | 2 +- .../springframework/boot/maven/StopMojo.java | 4 +- .../src/site/apt/examples/build-info.apt.vm | 56 ---- .../src/site/apt/examples/custom-layout.apt | 59 ---- .../apt/examples/exclude-dependency.apt.vm | 84 ----- .../site/apt/examples/it-random-port.apt.vm | 82 ----- .../src/site/apt/examples/it-skip.apt.vm | 63 ---- .../apt/examples/repackage-classifier.apt.vm | 187 ----------- .../examples/repackage-disable-attach.apt.vm | 50 --- .../site/apt/examples/repackage-name.apt.vm | 42 --- .../src/site/apt/examples/run-debug.apt.vm | 47 --- .../apt/examples/run-env-variables.apt.vm | 51 --- .../src/site/apt/examples/run-profiles.apt.vm | 47 --- .../apt/examples/run-system-properties.apt.vm | 61 ---- .../src/site/apt/index.apt | 74 ----- .../src/site/apt/usage.apt.vm | 314 ------------------ .../src/site/site.xml | 30 -- 19 files changed, 5 insertions(+), 1252 deletions(-) delete mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/build-info.apt.vm delete mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/custom-layout.apt delete mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/exclude-dependency.apt.vm delete mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/it-random-port.apt.vm delete mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/it-skip.apt.vm delete mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/repackage-classifier.apt.vm delete mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/repackage-disable-attach.apt.vm delete mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/repackage-name.apt.vm delete mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-debug.apt.vm delete mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-env-variables.apt.vm delete mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-profiles.apt.vm delete mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-system-properties.apt.vm delete mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt delete mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/usage.apt.vm delete mode 100644 spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java index 0423035ff64e..899a8f2c0901 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java @@ -51,7 +51,7 @@ import org.springframework.boot.loader.tools.Repackager.MainClassTimeoutWarningListener; /** - * Repackages existing JAR and WAR archives so that they can be executed from the command + * Repackage existing JAR and WAR archives so that they can be executed from the command * line using {@literal java -jar}. With layout=NONE can also be used simply * to package a JAR with nested dependencies (and no main class, so not executable). * diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java index 510ae049a9a1..0b398faeee0e 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RunMojo.java @@ -34,7 +34,7 @@ import org.springframework.boot.loader.tools.RunProcess; /** - * Run an executable archive application. + * Run an application in place. * * @author Phillip Webb * @author Dmytro Nosan diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java index 240d9d41a7cb..f1cbfa1bdddb 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java @@ -42,7 +42,7 @@ /** * Start a spring application. Contrary to the {@code run} goal, this does not block and - * allows other goal to operate on the application. This goal is typically used in + * allows other goals to operate on the application. This goal is typically used in * integration test scenario where the application is started before a test suite and * stopped after. * diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java index 52aae26fd7f2..b72f8595844f 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java @@ -32,8 +32,8 @@ import org.apache.maven.project.MavenProject; /** - * Stop a spring application that has been started by the "start" goal. Typically invoked - * once a test suite has completed. + * Stop an application that has been started by the "start" goal. Typically invoked once a + * test suite has completed. * * @author Stephane Nicoll * @since 1.3.0 diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/build-info.apt.vm b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/build-info.apt.vm deleted file mode 100644 index 359a55cabe7d..000000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/build-info.apt.vm +++ /dev/null @@ -1,56 +0,0 @@ - ----- - Generate build information - ----- - Stephane Nicoll - ----- - 2016-03-17 - ----- - - Spring Boot Actuator displays build-related information if a <<>> - file is present. The <<>> goal generates such file with the coordinates of the project - and the build time. It also allows you to add an arbitrary number of additional properties: - ---- - - ... - - ... - - ... - - ${project.groupId} - ${project.artifactId} - ${project.version} - - - - build-info - - - - UTF-8 - UTF-8 - ${maven.compiler.source} - ${maven.compiler.target} - - - - - ... - - ... - - ... - - ... - ---- - - This configuration will generate a <<>> at the expected location with - four additional keys. Note that <<>> and <<>> - are expected to be regular properties available in the project. They will be interpolated as - you would expect. - - - - diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/custom-layout.apt b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/custom-layout.apt deleted file mode 100644 index 2cffd8f02959..000000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/custom-layout.apt +++ /dev/null @@ -1,59 +0,0 @@ - ----- - Use a custom layout - ----- - Dave Syer - ----- - 2016-10-30 - ----- - - Spring Boot repackages the jar file for this project using a custom layout factory - defined in the additional jar file, provided as a dependency to the build plugin: - ---- - - ... - - ... - - ... - - ${project.groupId} - ${project.artifactId} - ${project.version} - - - repackage - - repackage - - - - value - - - - - - - com.example - custom-layout - 0.0.1.BUILD-SNAPSHOT - - - ... - - ... - - ... - - ... - ---- - - The layout factory is provided as an implementation of <<>> (from - spring-boot-loader-tools) explicitly specified in the pom. If there is only one custom - <<>> on the plugin classpath and it is listed in - <<>> then it is unnecessary to explicitly set it in the - plugin configuration. - - Layout factories are always ignored if an explicit <> is set. diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/exclude-dependency.apt.vm b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/exclude-dependency.apt.vm deleted file mode 100644 index a99283699146..000000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/exclude-dependency.apt.vm +++ /dev/null @@ -1,84 +0,0 @@ - ----- - Exclude a dependency - ----- - Stephane Nicoll - ----- - 2014-05-06 - ----- - - By default, both the <<>> and the <<>> goals will include any <<>> - dependencies that are defined in the project. A Spring Boot project should consider - <<>> dependencies as <> dependencies that are required to run - the application. - - Some of these dependencies may not be required at all and should be excluded from the - executable jar. For consistency, they should not be present either when running the - application. - - There are two ways one can exclude a dependency from being packaged/used at runtime - - * Exclude a specific artifact identified by <<>> and <<>> - (optionally with a <<>> if needed) - - * Exclude any artifact belonging to a given <<>> - - [] - - The following excludes <<>> (and only that artifact) - ---- - - ... - - ... - - ... - - ${project.groupId} - ${project.artifactId} - ${project.version} - - - - com.foo - bar - - - - ... - - ... - - ... - - ... - ---- - - This example excludes any artifact belonging to the <<>> group - - ---- - - ... - - ... - - ... - - ${project.groupId} - ${project.artifactId} - ${project.version} - - com.foo - - ... - - ... - - ... - - ... - ---- - diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/it-random-port.apt.vm b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/it-random-port.apt.vm deleted file mode 100644 index 8635e87c3bb3..000000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/it-random-port.apt.vm +++ /dev/null @@ -1,82 +0,0 @@ - ----- - Random port for integration tests - ----- - Stephane Nicoll - ----- - 2015-04-16 - ----- - - One nice feature of the Spring Boot test integration is that it can allocate a free - port for the web application. When the <<>> goal of the plugin is used, the - Spring Boot application is started separately, making it difficult to pass the actual - port to the integration test itself. - - The example below showcases how you could achieve the same feature using the - {{{https://www.mojohaus.org/build-helper-maven-plugin/}build-helper-plugin}}: - ---- - - ... - - ... - - ... - - org.codehaus.mojo - build-helper-maven-plugin - - - reserve-tomcat-port - - reserve-network-port - - process-resources - - - tomcat.http.port - - - - - - - ${project.groupId} - ${project.artifactId} - ${project.version} - - - pre-integration-test - - start - - - - --server.port=${tomcat.http.port} - - - - - post-integration-test - - stop - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - ${tomcat.http.port} - - - - ... - - ... - ---- - - You can now retrieve the <<>> system property in any of your integration test - to create a proper <<>> to the server. diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/it-skip.apt.vm b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/it-skip.apt.vm deleted file mode 100644 index f846bca20c5c..000000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/it-skip.apt.vm +++ /dev/null @@ -1,63 +0,0 @@ - ----- - Skip integration tests - ----- - Stephane Nicoll - ----- - 2016-11-25 - ----- - - The <<>> property allows to skip the execution of the Spring Boot maven plugin - altogether. This example shows how you can skip integration tests with a command-line - property and still make sure that the <> goal runs: - ---- - - - false - ... - - ... - - ... - - ... - - ${project.groupId} - ${project.artifactId} - ${project.version} - - - pre-integration-test - - start - - - ${skip.it} - - - - post-integration-test - - stop - - - ${skip.it} - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - ${skip.it} - - - ... - - ... - ---- - - By default, the integration tests will run but this setup allows you to easily disable - them on the command-line as follows: <<>>. diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/repackage-classifier.apt.vm b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/repackage-classifier.apt.vm deleted file mode 100644 index d64dc2ea6438..000000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/repackage-classifier.apt.vm +++ /dev/null @@ -1,187 +0,0 @@ - ----- - Repackage classifier - ----- - Stephane Nicoll - ----- - 2014-05-02 - ----- - - By default, the <<>> goal will replace the original artifact with the - repackaged one. That's a sane behavior for modules that represent an app but if - your module is used as a dependency of another module, you need to provide a - classifier for the repackaged one. - - The reason for that is that application classes are packaged in <<>> - so that the dependent module cannot load a repackaged jar's classes. If that is the - case or if you prefer to keep the original artifact and attach the repackaged one - with a different classifier, configure the plugin as follows: - ---- - - ... - - ... - - ... - - ${project.groupId} - ${project.artifactId} - ${project.version} - - - repackage - - repackage - - - exec - - - - ... - - ... - - ... - - ... - ---- - - If you are using `spring-boot-starter-parent`, the `repackage` goal is executed - automatically in an execution with id `repackage`. In that setup, only the configuration - should be specified as shown in the following example: - ---- - - ... - - ... - - ... - - ${project.groupId} - ${project.artifactId} - - - repackage - - exec - - - - ... - - ... - - ... - - ... - ---- - - This configuration will generate two artifacts: the original one and the repackaged - counter part produced by the repackage goal. Both will be installed/deployed - transparently. - - You can also use the same configuration if you want to repackage a secondary artifact - the same way the main artifact is replaced. The following configuration installs/deploys - a single <<>> classified artifact with the repackaged app: - ---- - - ... - - ... - - ... - - org.apache.maven.plugins - maven-jar-plugin - @maven-jar-plugin.version@ - - - - jar - - package - - task - - - - - - ${project.groupId} - ${project.artifactId} - ${project.version} - - - repackage - - repackage - - - task - - - - ... - - ... - - ... - - ... - ---- - - As both the <<>> and the <<>> runs at the - same phase, it is important that the jar plugin is defined first (so that it runs before - the repackage goal). - - Again, if you are using `spring-boot-starter-parent`, this can be simplified as follows: - ---- - - ... - - ... - - ... - - org.apache.maven.plugins - maven-jar-plugin - - - default-jar - - task - - - - - - ${project.groupId} - ${project.artifactId} - - - repackage - - task - - - - ... - - ... - - ... - - ... - ---- - - - - diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/repackage-disable-attach.apt.vm b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/repackage-disable-attach.apt.vm deleted file mode 100644 index dcd4dfa142c2..000000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/repackage-disable-attach.apt.vm +++ /dev/null @@ -1,50 +0,0 @@ - ----- - Local repackaged artifact - ----- - Stephane Nicoll - ----- - 2016-03-01 - ----- - - By default, the <<>> goal will replace the original artifact with the - executable one. If you need to only deploy the original jar and yet be able to - run your app with the regular file name, configure the plugin as follows: - ---- - - ... - - ... - - ... - - ${project.groupId} - ${project.artifactId} - ${project.version} - - - repackage - - repackage - - - false - - - - ... - - ... - - ... - - ... - ---- - - This configuration will generate two artifacts: the original one and the executable counter - part produced by the repackage goal. Only the original one will be installed/deployed. - - - - diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/repackage-name.apt.vm b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/repackage-name.apt.vm deleted file mode 100644 index 9a21dd9ff88d..000000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/repackage-name.apt.vm +++ /dev/null @@ -1,42 +0,0 @@ - ----- - Repackage classifier - ----- - Stephane Nicoll - ----- - 2019-03-29 - ----- - - If you need the repackaged jar to have a different local name than the one defined by - the <<>> attribute of the project, simply use the standard <<>> - as shown in the following example: - ---- - - ... - - my-app - - ... - - ${project.groupId} - ${project.artifactId} - ${project.version} - - - repackage - - repackage - - - - ... - - ... - - ... - - ... - ---- - - This configuration will generate the repackaged artifact in <<>>. diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-debug.apt.vm b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-debug.apt.vm deleted file mode 100644 index d8d5d0261bac..000000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-debug.apt.vm +++ /dev/null @@ -1,47 +0,0 @@ - ----- - Debug the application - ----- - Stephane Nicoll - ----- - 2014-05-14 - ----- - - By default, the <<>> goal runs your application in a forked process. If you need to - debug it, you should add the necessary JVM arguments to enable remote debugging. The - following configuration suspend the process until a debugger has joined on port 5005: - ---- - - ... - - ... - - ... - - ${project.groupId} - ${project.artifactId} - ${project.version} - - - -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 - - - ... - - ... - - ... - - ... - ---- - - These arguments can be specified on the command line as well, make sure to wrap that - properly, that is: - ---- -mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" ---- - - - diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-env-variables.apt.vm b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-env-variables.apt.vm deleted file mode 100644 index 7a3b7e560aa5..000000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-env-variables.apt.vm +++ /dev/null @@ -1,51 +0,0 @@ - ----- - Using environment variables - ----- -Dmytro Nosan - ----- - 2018-04-08 - ----- - - Environment variables can be specified using the <<>> attribute. - The following sets the 'ENV1', 'ENV2', 'ENV3', 'ENV4' env variables: - ---- - - ... - - ... - - ... - - ${project.groupId} - ${project.artifactId} - ${project.version} - - - 5000 - Some Text - - - - - ... - - ... - - ... - - ... - ---- - - If the value is empty or not defined (i.e. <<<>>>), the env variable is set - with an empty String as the value. Maven trims values specified in the pom so it is - not possible to specify an env variable which needs to start or end with a space. - - Any String typed Maven variable can be passed as system properties. Any attempt to pass - any other Maven variable type (e.g. a <<>> or a <<>> variable) will cause the - variable expression to be passed literally (unevaluated). - - Environment variables defined this way take precedence over existing values. - - diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-profiles.apt.vm b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-profiles.apt.vm deleted file mode 100644 index 203add200eb9..000000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-profiles.apt.vm +++ /dev/null @@ -1,47 +0,0 @@ - ----- - Specify active profiles - ----- - Stephane Nicoll - ----- - 2014-07-07 - ----- - - The active profiles to use for a particular application can be specified using the <<>> - argument. The following configuration enables the foo and bar profiles: - ---- - - ... - - ... - - ... - - ${project.groupId} - ${project.artifactId} - ${project.version} - - - foo - bar - - - ... - - ... - - ... - - ... - ---- - - The profiles to enable can be specified on the command line as well, make sure to separate them with - a comma, that is: - ---- -mvn spring-boot:run -Dspring-boot.run.profiles=foo,bar ---- - - - diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-system-properties.apt.vm b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-system-properties.apt.vm deleted file mode 100644 index 0483f58f9dff..000000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/run-system-properties.apt.vm +++ /dev/null @@ -1,61 +0,0 @@ - ----- - Using System Properties - ----- - Stephane Nicoll - ----- - 2018-04-24 - ----- - - System properties can be specified using the <<>> attribute. - The following sets <<>> to <<>> and <<>> to 42: - ---- - - ... - - - 42 - - ... - - ... - - ${project.groupId} - ${project.artifactId} - ${project.version} - - - test - ${my.value} - - - ... - - ... - - ... - - ... - ---- - - If the value is empty or not defined (i.e. <<<>>>), the system property - is set with an empty String as the value. Maven trims values specified in the pom so it - is not possible to specify a System property which needs to start or end with a space via - this mechanism: consider using <<>> instead. - - Any String typed Maven variable can be passed as system properties. Any attempt to pass - any other Maven variable type (e.g. a <<>> or a <<>> variable) will cause the - variable expression to be passed literally (unevaluated). - - The <<>> parameter takes precedence over system properties defined with - the mechanism above. In the following example, the value for <<>> is - <<>>: - - ---- -mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dproperty1=overridden" ---- - - - diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt deleted file mode 100644 index 64cd7a049a6d..000000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt +++ /dev/null @@ -1,74 +0,0 @@ - ----- - Spring Boot - ----- - Stephane Nicoll - ----- - 2014-05-02 - ----- - -Spring Boot Maven Plugin - - The Spring Boot Maven Plugin provides Spring Boot support in Maven, allowing you to package executable - jar or war archives and run an application “in-place”. - -* Goals Overview - - The Spring Boot Plugin has the following goals. - - * {{{./run-mojo.html}spring-boot:run}} runs your Spring Boot application. - - * {{{./repackage-mojo.html}spring-boot:repackage}} repackages your jar/war to be executable. - - * {{{./start-mojo.html}spring-boot:start}} and {{{./stop-mojo.html}spring-boot:stop}} to manage - the lifecycle of your Spring Boot application (i.e. for integration tests). - - * {{{./build-info-mojo.html}spring-boot:build-info}} generates build information that can be used - by the Actuator. - - - -* Usage - - General instructions on how to use the Spring Boot Plugin can be found on the {{{./usage.html}usage page}}. Some - more specific use cases are described in the examples given below. - - In case you still have questions regarding the plugin's usage, please have a look at the existing - {{{https://stackoverflow.com/questions/tagged/spring-boot}stack overflow issue}}. If you still don't get an - answer, feel free to create a new thread with the <<<#spring-boot>>> tag. - - If you feel like the plugin is missing a feature or has a defect, you can fill a feature request or bug report - in our {{{./issue-tracking.html}issue tracker}}. - -* Examples - - To provide you with better understanding of some usages of Spring Boot, you can take a look into - the following examples: - - * {{{./examples/repackage-classifier.html}Custom repackage classifier}} - - * {{{./examples/repackage-name.html}Custom repackage name}} - - * {{{./examples/repackage-disable-attach.html}Local repackaged artifact}} - - * {{{./examples/exclude-dependency.html}Exclude a dependency}} - - * {{{./examples/run-debug.html}Debug the application}} - - * {{{./examples/run-system-properties.html}Using system properties}} - - * {{{./examples/run-env-variables.html}Using environment variables}} - - * {{{./examples/it-random-port.html}Random port for integration tests}} - - * {{{./examples/it-skip.html}Skip integration tests}} - - * {{{./examples/run-profiles.html}Specify active profiles}} - - * {{{./examples/build-info.html}Generate build information}} - - * {{{./examples/custom-layout.html}Custom layout}} - - [] - - - diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/usage.apt.vm b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/usage.apt.vm deleted file mode 100644 index fb70a9769758..000000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/usage.apt.vm +++ /dev/null @@ -1,314 +0,0 @@ - - ----- - Usage - ----- - Stephane Nicoll - ----- - 2014-05-06 - ----- - -Usage - - The plugin provides several goals to work with a Spring Boot application: - - * <<>>: create a jar or war file that is auto-executable. It can replace the regular artifact or can be - attached to the build lifecycle with a separate <>. - - * <<>>: run your Spring Boot application with several options to pass parameters to it. - - * <<>> and <<>>: integrate your Spring Boot application to the <<>> phase so that - the application starts before it. - - * <<>>: generate a build information that can be used by the Actuator. - - [] - - Each goal is further described below. - -* Repackaging an application - - In order to repackage your application, you simply need to add a reference to the - plugin in your <<>>: - ---- - - ... - - ... - - ${project.groupId} - ${project.artifactId} - ${project.version} - - - - repackage - - - - - ... - - ... - ---- - - The example above repackages a jar or war that is built during the package phase of the Maven lifecycle, - including any <<>> dependencies that are defined in the project. If some of these dependencies - need to be excluded, you can use one of the exclude options, - see {{{./examples/exclude-dependency.html}Exclude a dependency}} for more details. - Please note that the <<>> feature of the <<>> - is currently not supported. - - Devtools is automatically excluded by default (you can control that using the - <<>> property). In order to make that work with <<>> packaging, - the <<>> dependency must be set as <<>> or with the - <<>> scope. - - The original (i.e. non executable) artifact is renamed to <<<.original>>> by default but it is also - possible to keep the original artifact using a custom classifier. - - The plugin rewrites your manifest, and in particular it manages the <> and <> - entries, so if the defaults don't work you have to configure those there (not in the jar plugin). The - <> in the manifest is actually controlled by the <> property of the boot plugin, e.g. - ---- - - ... - - ... - - ${project.groupId} - ${project.artifactId} - ${project.version} - - ${start-class} - ZIP - - - - - repackage - - - - - ... - - ... - ---- - - The <<>> property defaults to a guess based on the archive type (<<>> or <<>>). The - following layouts are available: - - * <<>>: regular executable JAR layout. - - * <<>>: executable WAR layout. <<>> dependencies are placed in <<>> - to avoid any clash when the <<>> is deployed in a servlet container. - - * <<>> (alias to <<>>): similar to the <<>> layout using <<>>. - - * <<>>: Bundle all dependencies and project resources. Does not bundle a bootstrap loader. - - [] - - For more detailed examples of how to configure this goal see: - - * {{{./examples/repackage-classifier.html}Custom repackage classifier}} - - * {{{./examples/exclude-dependency.html}Exclude a dependency}} - - [] - -* Running the application - - The plugin includes a run goal which can be used to launch your application from the command - line: - ---- -mvn spring-boot:run ---- - - By default the application is executed in a forked process and setting properties on the - command-line will not affect the application. If you need to specify some JVM arguments - (i.e. for debugging purposes), you can use the <<>> parameter, see - {{{./examples/run-debug.html}Debug the application}} for more details. There is also - explicit support for {{{./examples/run-system-properties.html}system properties}} and - {{{./examples/run-env-variables.html}environment variables}}. - - As enabling a profile is quite common, there is dedicated <<>> property that - offers a shortcut for - <<<-Dspring-boot.run.jvmArguments="-Dspring.profiles.active=dev">>>, - see {{{./examples/run-profiles.html}Specify active profiles}}. - - Although this is not recommended, it is possible to execute the application directly - from the Maven JVM by disabling the <<>> property. Doing so means that the - <<>>, <<>>, <<>> and - <<>> options are ignored. - - Spring Boot 1.3 has introduced <<>>, a module to improve the development-time - experience when working on Spring Boot applications. To enable it, just add the following - dependency to your project: - ---- - - - org.springframework.boot - spring-boot-devtools - ${project.version} - true - - ---- - - When <<>> is running, it detects change when you recompile your application and - automatically refreshes it. This works for not only resources but code as well. It also - provides a LiveReload server so that it can automatically trigger a browser refresh whenever - things change. - - Devtools can also be configured to only refresh the browser whenever a static resource has - changed (and ignore any change in the code). Just include the following property in your - project: - ---- -spring.devtools.remote.restart.enabled=false ---- - - Prior to <<>>, the plugin supported hot refreshing of resources by default which has - now be disabled in favour of the solution described above. You can restore it at any time by - configuring your project: - ---- - - ... - - ... - - ${project.groupId} - ${project.artifactId} - ${project.version} - - true - - - ... - - ... - ---- - - When <<>> is enabled, any <> folder will be added to - the application classpath when you run the application and any duplicate found in - <> will be removed. This allows hot refreshing of resources which can be very - useful when developing web applications. For example, you can work on HTML, CSS or JavaScript - files and see your changes immediately without recompiling your application. It is also a helpful - way of allowing your front end developers to work without needing to download and install a Java - IDE. - - Note that a side effect of using this feature is that filtering of resources at build time will - not work. - - In order to be consistent with the <<>> goal, the <<>> goal builds the classpath - in such a way that any dependency that is excluded in the plugin's configuration gets excluded - from the classpath as well. See {{{./examples/exclude-dependency.html}Exclude a dependency}} for - more details. - - Sometimes it is useful to include test dependencies when running the application. For example, - if you want to run your application in a test mode that uses stub classes. If you wish to do this, - you can set the <<>> parameter to true. Note that this is only applied when you - run an application: the <<>> goal will not add test dependencies to the resulting JAR/WAR. - -* Working with integration tests - - While you may start your Spring Boot application very easily from your test (or test suite) itself, - it may be desirable to handle that in the build itself. To make sure that the lifecycle of your Spring - Boot application is properly managed your integration tests, you can use the <<>> and - <<>> goals as described below: - ---- - - ... - - ... - - ${project.groupId} - ${project.artifactId} - ${project.version} - - - pre-integration-test - - start - - - - post-integration-test - - stop - - - - - ... - - ... - ---- - - Such setup can now use the {{{https://maven.apache.org/surefire/maven-failsafe-plugin/}failsafe-plugin}} to - run your integration tests as you would expect. - - You could also configure a more advanced setup to skip the integration tests when a specific property has - been set: - ---- - - false - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - ${it.skip} - - - - ${project.groupId} - ${project.artifactId} - ${project.version} - - - pre-integration-test - - start - - - ${it.skip} - - - - post-integration-test - - stop - - - ${it.skip} - - - - - - ---- - - If you run <<>> your integration tests will be skipped altogether. - - - For more detailed examples of how to configure this goal see: - - * {{{./examples/it-random-port.html}Random port for integration tests}} - - [] diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml deleted file mode 100644 index 6711b55c15cb..000000000000 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - org.apache.maven.skins - maven-fluido-skin - 1.6 - - From 21dc7e9ca32b31e86ec90249e24ac158297d3dff Mon Sep 17 00:00:00 2001 From: dreis2211 Date: Thu, 21 Nov 2019 17:36:33 +0100 Subject: [PATCH 19/65] Fix StepVerifier usage in HealthIndicatorReactiveAdapterTests --- .../actuate/health/HealthIndicatorReactiveAdapterTests.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthIndicatorReactiveAdapterTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthIndicatorReactiveAdapterTests.java index 72754f953c4b..494a9d6b700f 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthIndicatorReactiveAdapterTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthIndicatorReactiveAdapterTests.java @@ -16,6 +16,8 @@ package org.springframework.boot.actuate.health; +import java.time.Duration; + import org.junit.jupiter.api.Test; import reactor.test.StepVerifier; @@ -44,7 +46,7 @@ void delegateThrowError() { HealthIndicator delegate = mock(HealthIndicator.class); HealthIndicatorReactiveAdapter adapter = new HealthIndicatorReactiveAdapter(delegate); given(delegate.health()).willThrow(new IllegalStateException("Expected")); - StepVerifier.create(adapter.health()).expectError(IllegalStateException.class); + StepVerifier.create(adapter.health()).expectError(IllegalStateException.class).verify(Duration.ofSeconds(10)); } @Test From 60640ea1857b8611158255cf6dafd1de00282516 Mon Sep 17 00:00:00 2001 From: dreis2211 Date: Sun, 24 Nov 2019 21:32:35 +0100 Subject: [PATCH 20/65] Fix link in new Maven Plugin docs See gh-19108 --- .../src/main/asciidoc/integration-tests.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/integration-tests.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/integration-tests.adoc index c0ed01fd3712..31317f42983e 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/integration-tests.adoc +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/asciidoc/integration-tests.adoc @@ -31,7 +31,7 @@ To make sure that the lifecycle of your Spring Boot application is properly mana ---- -Such setup can now use the https://maven.apache.org/surefire/maven-failsafe-plugin[failsafe-plugi to run your integration tests as you would expect. +Such setup can now use the https://maven.apache.org/surefire/maven-failsafe-plugin[failsafe-plugin] to run your integration tests as you would expect. You could also configure a more advanced setup to skip the integration tests when a specific property has been set, see <>. From c0430685782fddc3a3db78030b0e42ad9990d08a Mon Sep 17 00:00:00 2001 From: Franjo Zilic Date: Sat, 23 Nov 2019 13:13:59 +0100 Subject: [PATCH 21/65] Add configuration for RabbitMQ requested channel max property See gh-19106 --- .../amqp/RabbitAutoConfiguration.java | 1 + .../autoconfigure/amqp/RabbitProperties.java | 16 ++++++++++++++++ .../amqp/RabbitAutoConfigurationTests.java | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java index 8d81b0932baf..5f146086c992 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java @@ -140,6 +140,7 @@ private RabbitConnectionFactoryBean getRabbitConnectionFactoryBean(RabbitPropert } map.from(properties::getConnectionTimeout).whenNonNull().asInt(Duration::toMillis) .to(factory::setConnectionTimeout); + map.from(properties::getRequestedChannelMax).whenNonNull().to(factory::setRequestedChannelMax); factory.afterPropertiesSet(); return factory; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java index a10787d99b6d..403d6a033ff6 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java @@ -40,6 +40,7 @@ * @author Josh Thornhill * @author Gary Russell * @author Artsiom Yudovin + * @author Franjo Zilic * @since 1.0.0 */ @ConfigurationProperties(prefix = "spring.rabbitmq") @@ -102,6 +103,13 @@ public class RabbitProperties { */ private Duration connectionTimeout; + /** + * Requested Channel Max; zero for unlimited. Number of channels per connection client + * will request from server, actual maximum will be negotiated between client and + * server for lowest value (excluding zero as it represents unlimited). + */ + private Integer requestedChannelMax; + /** * Cache configuration. */ @@ -310,6 +318,14 @@ public void setConnectionTimeout(Duration connectionTimeout) { this.connectionTimeout = connectionTimeout; } + public Integer getRequestedChannelMax() { + return this.requestedChannelMax; + } + + public void setRequestedChannelMax(Integer requestedChannelMax) { + this.requestedChannelMax = requestedChannelMax; + } + public Cache getCache() { return this.cache; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java index bfe14c13bc81..560d8061f283 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java @@ -81,6 +81,7 @@ * @author Stephane Nicoll * @author Gary Russell * @author HaiTao Zhang + * @author Franjo Zilic */ class RabbitAutoConfigurationTests { @@ -715,6 +716,24 @@ private TrustManager getTrustManager(com.rabbitmq.client.ConnectionFactory rabbi return (TrustManager) trustManager; } + @Test + void testChangeDefaultRequestedChannelMax() throws Exception { + this.contextRunner.withUserConfiguration(TestConfiguration.class) + .withPropertyValues("spring.rabbitmq.requestedChannelMax:12").run((context) -> { + com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory = getTargetConnectionFactory(context); + assertThat(rabbitConnectionFactory.getRequestedChannelMax()).isEqualTo(12); + }); + } + + @Test + void testKeepDefaultRequestedChannelMax() throws Exception { + this.contextRunner.withUserConfiguration(TestConfiguration.class).run((context) -> { + com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory = getTargetConnectionFactory(context); + assertThat(rabbitConnectionFactory.getRequestedChannelMax()) + .isEqualTo(com.rabbitmq.client.ConnectionFactory.DEFAULT_CHANNEL_MAX); + }); + } + private com.rabbitmq.client.ConnectionFactory getTargetConnectionFactory(AssertableApplicationContext context) { CachingConnectionFactory connectionFactory = context.getBean(CachingConnectionFactory.class); return connectionFactory.getRabbitConnectionFactory(); From d2f256abe8c5b42af8be81ae20a86bb64706fa79 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 27 Nov 2019 10:33:46 +0100 Subject: [PATCH 22/65] Polish "Add configuration for RabbitMQ requested channel max property" See gh-19106 --- .../amqp/RabbitAutoConfiguration.java | 2 +- .../autoconfigure/amqp/RabbitProperties.java | 28 +++++++++--------- .../amqp/RabbitAutoConfigurationTests.java | 29 +++++++------------ 3 files changed, 25 insertions(+), 34 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java index 5f146086c992..e9f717f05faf 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java @@ -124,6 +124,7 @@ private RabbitConnectionFactoryBean getRabbitConnectionFactoryBean(RabbitPropert map.from(properties::determineVirtualHost).whenNonNull().to(factory::setVirtualHost); map.from(properties::getRequestedHeartbeat).whenNonNull().asInt(Duration::getSeconds) .to(factory::setRequestedHeartbeat); + map.from(properties::getRequestedChannelMax).to(factory::setRequestedChannelMax); RabbitProperties.Ssl ssl = properties.getSsl(); if (ssl.determineEnabled()) { factory.setUseSSL(true); @@ -140,7 +141,6 @@ private RabbitConnectionFactoryBean getRabbitConnectionFactoryBean(RabbitPropert } map.from(properties::getConnectionTimeout).whenNonNull().asInt(Duration::toMillis) .to(factory::setConnectionTimeout); - map.from(properties::getRequestedChannelMax).whenNonNull().to(factory::setRequestedChannelMax); factory.afterPropertiesSet(); return factory; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java index 403d6a033ff6..6eed4a93693b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java @@ -88,6 +88,11 @@ public class RabbitProperties { @DurationUnit(ChronoUnit.SECONDS) private Duration requestedHeartbeat; + /** + * Number of channels per connection requested by the client. Use 0 for unlimited. + */ + private int requestedChannelMax = 2047; + /** * Whether to enable publisher returns. */ @@ -103,13 +108,6 @@ public class RabbitProperties { */ private Duration connectionTimeout; - /** - * Requested Channel Max; zero for unlimited. Number of channels per connection client - * will request from server, actual maximum will be negotiated between client and - * server for lowest value (excluding zero as it represents unlimited). - */ - private Integer requestedChannelMax; - /** * Cache configuration. */ @@ -283,6 +281,14 @@ public void setRequestedHeartbeat(Duration requestedHeartbeat) { this.requestedHeartbeat = requestedHeartbeat; } + public int getRequestedChannelMax() { + return this.requestedChannelMax; + } + + public void setRequestedChannelMax(int requestedChannelMax) { + this.requestedChannelMax = requestedChannelMax; + } + @DeprecatedConfigurationProperty(reason = "replaced to support additional confirm types", replacement = "spring.rabbitmq.publisher-confirm-type") public boolean isPublisherConfirms() { @@ -318,14 +324,6 @@ public void setConnectionTimeout(Duration connectionTimeout) { this.connectionTimeout = connectionTimeout; } - public Integer getRequestedChannelMax() { - return this.requestedChannelMax; - } - - public void setRequestedChannelMax(Integer requestedChannelMax) { - this.requestedChannelMax = requestedChannelMax; - } - public Cache getCache() { return this.cache; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java index 560d8061f283..1630f03c05af 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfigurationTests.java @@ -100,6 +100,8 @@ void testDefaultRabbitConfiguration() { assertThat(messagingTemplate.getRabbitTemplate()).isEqualTo(rabbitTemplate); assertThat(amqpAdmin).isNotNull(); assertThat(connectionFactory.getHost()).isEqualTo("localhost"); + assertThat(getTargetConnectionFactory(context).getRequestedChannelMax()) + .isEqualTo(com.rabbitmq.client.ConnectionFactory.DEFAULT_CHANNEL_MAX); assertThat(connectionFactory.isPublisherConfirms()).isFalse(); assertThat(connectionFactory.isPublisherReturns()).isFalse(); assertThat(context.containsBean("rabbitListenerContainerFactory")) @@ -601,6 +603,15 @@ void customizeRequestedHeartBeat() { }); } + @Test + void customizeRequestedChannelMax() { + this.contextRunner.withUserConfiguration(TestConfiguration.class) + .withPropertyValues("spring.rabbitmq.requestedChannelMax:12").run((context) -> { + com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory = getTargetConnectionFactory(context); + assertThat(rabbitConnectionFactory.getRequestedChannelMax()).isEqualTo(12); + }); + } + @Test void noSslByDefault() { this.contextRunner.withUserConfiguration(TestConfiguration.class).run((context) -> { @@ -716,24 +727,6 @@ private TrustManager getTrustManager(com.rabbitmq.client.ConnectionFactory rabbi return (TrustManager) trustManager; } - @Test - void testChangeDefaultRequestedChannelMax() throws Exception { - this.contextRunner.withUserConfiguration(TestConfiguration.class) - .withPropertyValues("spring.rabbitmq.requestedChannelMax:12").run((context) -> { - com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory = getTargetConnectionFactory(context); - assertThat(rabbitConnectionFactory.getRequestedChannelMax()).isEqualTo(12); - }); - } - - @Test - void testKeepDefaultRequestedChannelMax() throws Exception { - this.contextRunner.withUserConfiguration(TestConfiguration.class).run((context) -> { - com.rabbitmq.client.ConnectionFactory rabbitConnectionFactory = getTargetConnectionFactory(context); - assertThat(rabbitConnectionFactory.getRequestedChannelMax()) - .isEqualTo(com.rabbitmq.client.ConnectionFactory.DEFAULT_CHANNEL_MAX); - }); - } - private com.rabbitmq.client.ConnectionFactory getTargetConnectionFactory(AssertableApplicationContext context) { CachingConnectionFactory connectionFactory = context.getBean(CachingConnectionFactory.class); return connectionFactory.getRabbitConnectionFactory(); From 7b1b18cd77c3904641709273325b77c77e0134de Mon Sep 17 00:00:00 2001 From: Leo Li <269739606@qq.com> Date: Tue, 19 Nov 2019 13:49:56 +0800 Subject: [PATCH 23/65] Add support for test containers jdbc url See gh-19044 --- .../springframework/boot/jdbc/DatabaseDriver.java | 12 ++++++++++++ .../boot/jdbc/DatabaseDriverClassNameTests.java | 6 +++--- .../boot/jdbc/DatabaseDriverTests.java | 2 ++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java index fa134ddef4f2..3470154b5a38 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java @@ -196,6 +196,18 @@ protected Collection getUrlPrefixes() { return Arrays.asList("informix-sqli", "informix-direct"); } + }, + + /** + * Testcontainers. + */ + TESTCONTAINERS(null, "org.testcontainers.jdbc.ContainerDatabaseDriver") { + + @Override + protected Collection getUrlPrefixes() { + return Collections.singleton("tc"); + } + }; private final String productName; diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverClassNameTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverClassNameTests.java index 92272c0b0a3a..82cfbf564be4 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverClassNameTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverClassNameTests.java @@ -44,9 +44,9 @@ */ class DatabaseDriverClassNameTests { - private static final Set EXCLUDED_DRIVERS = Collections - .unmodifiableSet(EnumSet.of(DatabaseDriver.UNKNOWN, DatabaseDriver.DB2_AS400, DatabaseDriver.INFORMIX, - DatabaseDriver.HANA, DatabaseDriver.TERADATA, DatabaseDriver.REDSHIFT)); + private static final Set EXCLUDED_DRIVERS = Collections.unmodifiableSet( + EnumSet.of(DatabaseDriver.UNKNOWN, DatabaseDriver.DB2_AS400, DatabaseDriver.INFORMIX, DatabaseDriver.HANA, + DatabaseDriver.TERADATA, DatabaseDriver.REDSHIFT, DatabaseDriver.TESTCONTAINERS)); @ParameterizedTest(name = "{0} {2}") @MethodSource diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java index ce870dfb0130..7d03ae8339db 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java @@ -112,6 +112,8 @@ void databaseJdbcUrlLookups() { assertThat(DatabaseDriver.fromJdbcUrl("jdbc:informix-sqli://localhost:1533/sample")) .isEqualTo(DatabaseDriver.INFORMIX); assertThat(DatabaseDriver.fromJdbcUrl("jdbc:informix-direct://sample")).isEqualTo(DatabaseDriver.INFORMIX); + assertThat(DatabaseDriver.fromJdbcUrl("jdbc:tc:sample://localhost:3306/sample")) + .isEqualTo(DatabaseDriver.TESTCONTAINERS); } } From 4c7896b936c5933e43f32208d7aa35595e9049ee Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 27 Nov 2019 11:01:56 +0100 Subject: [PATCH 24/65] Polish "Add support for test containers jdbc url" See gh-19044 --- spring-boot-project/spring-boot/pom.xml | 15 +++++++++++++++ .../boot/jdbc/DatabaseDriverClassNameTests.java | 6 +++--- .../boot/jdbc/DatabaseDriverTests.java | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/spring-boot-project/spring-boot/pom.xml b/spring-boot-project/spring-boot/pom.xml index cb3d81a582d6..e42cf6267224 100644 --- a/spring-boot-project/spring-boot/pom.xml +++ b/spring-boot-project/spring-boot/pom.xml @@ -472,6 +472,21 @@ spring-data-redis test + + org.testcontainers + jdbc + test + + + javax.annotation + javax.annotation-api + + + javax.xml.bind + jaxb-api + + + org.xerial sqlite-jdbc diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverClassNameTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverClassNameTests.java index 82cfbf564be4..92272c0b0a3a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverClassNameTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverClassNameTests.java @@ -44,9 +44,9 @@ */ class DatabaseDriverClassNameTests { - private static final Set EXCLUDED_DRIVERS = Collections.unmodifiableSet( - EnumSet.of(DatabaseDriver.UNKNOWN, DatabaseDriver.DB2_AS400, DatabaseDriver.INFORMIX, DatabaseDriver.HANA, - DatabaseDriver.TERADATA, DatabaseDriver.REDSHIFT, DatabaseDriver.TESTCONTAINERS)); + private static final Set EXCLUDED_DRIVERS = Collections + .unmodifiableSet(EnumSet.of(DatabaseDriver.UNKNOWN, DatabaseDriver.DB2_AS400, DatabaseDriver.INFORMIX, + DatabaseDriver.HANA, DatabaseDriver.TERADATA, DatabaseDriver.REDSHIFT)); @ParameterizedTest(name = "{0} {2}") @MethodSource diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java index 7d03ae8339db..0307a3a55077 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java @@ -112,7 +112,7 @@ void databaseJdbcUrlLookups() { assertThat(DatabaseDriver.fromJdbcUrl("jdbc:informix-sqli://localhost:1533/sample")) .isEqualTo(DatabaseDriver.INFORMIX); assertThat(DatabaseDriver.fromJdbcUrl("jdbc:informix-direct://sample")).isEqualTo(DatabaseDriver.INFORMIX); - assertThat(DatabaseDriver.fromJdbcUrl("jdbc:tc:sample://localhost:3306/sample")) + assertThat(DatabaseDriver.fromJdbcUrl("jdbc:tc:mysql://localhost:3306/sample")) .isEqualTo(DatabaseDriver.TESTCONTAINERS); } From 8a730ff630457b87d6367cf4259ad249cbfbd7da Mon Sep 17 00:00:00 2001 From: dreis2211 Date: Mon, 25 Nov 2019 21:34:10 +0100 Subject: [PATCH 25/65] Use DateTimeFormatter in favor of SimpleDateFormat See gh-19142 --- .../boot/actuate/management/HeapDumpWebEndpoint.java | 6 +++--- .../management/PlainTextThreadDumpFormatter.java | 8 ++++---- .../org/springframework/boot/info/GitProperties.java | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/management/HeapDumpWebEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/management/HeapDumpWebEndpoint.java index c2f9fee1fb1d..51d64b258c2b 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/management/HeapDumpWebEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/management/HeapDumpWebEndpoint.java @@ -27,8 +27,8 @@ import java.nio.ByteBuffer; import java.nio.channels.ReadableByteChannel; import java.nio.file.Files; -import java.text.SimpleDateFormat; -import java.util.Date; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; @@ -106,7 +106,7 @@ private Resource dumpHeap(boolean live) throws IOException, InterruptedException } private File createTempFile(boolean live) throws IOException { - String date = new SimpleDateFormat("yyyy-MM-dd-HH-mm").format(new Date()); + String date = DateTimeFormatter.ofPattern("yyyy-MM-dd-HH-mm").format(LocalDateTime.now()); File file = File.createTempFile("heapdump" + date + (live ? "-live" : ""), ".hprof"); file.delete(); return file; diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/management/PlainTextThreadDumpFormatter.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/management/PlainTextThreadDumpFormatter.java index 50e801c2497c..80569a79675e 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/management/PlainTextThreadDumpFormatter.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/management/PlainTextThreadDumpFormatter.java @@ -23,8 +23,8 @@ import java.lang.management.MonitorInfo; import java.lang.management.RuntimeMXBean; import java.lang.management.ThreadInfo; -import java.text.SimpleDateFormat; -import java.util.Date; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -47,8 +47,8 @@ String format(ThreadInfo[] threads) { } private void writePreamble(PrintWriter writer) { - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - writer.println(dateFormat.format(new Date())); + DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + writer.println(dateFormat.format(LocalDateTime.now())); RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); writer.printf("Full thread dump %s (%s %s):%n", runtime.getVmName(), runtime.getVmVersion(), System.getProperty("java.vm.info")); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/GitProperties.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/GitProperties.java index 2f92ade60b81..d07f6cf88d78 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/GitProperties.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/GitProperties.java @@ -16,9 +16,9 @@ package org.springframework.boot.info; -import java.text.ParseException; -import java.text.SimpleDateFormat; import java.time.Instant; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; import java.util.Properties; /** @@ -108,11 +108,11 @@ private static String coerceToEpoch(String s) { if (epoch != null) { return String.valueOf(epoch); } - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); + DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssZ"); try { - return String.valueOf(format.parse(s).getTime()); + return String.valueOf(format.parse(s, Instant::from).toEpochMilli()); } - catch (ParseException ex) { + catch (DateTimeParseException ex) { return s; } } From 479cd8856b90193adb7b666746ebb0b9bad1c1f9 Mon Sep 17 00:00:00 2001 From: Victor Mandujano Date: Wed, 2 Oct 2019 21:27:31 -0500 Subject: [PATCH 26/65] Add dedicated namespace for RemoteIpValve properties See gh-18489 --- .../autoconfigure/web/ServerProperties.java | 130 ++++++++++++++++-- .../TomcatWebServerFactoryCustomizer.java | 13 +- ...TomcatWebServerFactoryCustomizerTests.java | 20 +++ 3 files changed, 145 insertions(+), 18 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java index 1eaae3ac6310..4c4ded84f257 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java @@ -63,6 +63,7 @@ * @author Rafiullah Hamedy * @author Dirk Deyne * @author HaiTao Zhang + * @author Victor Mandujano * @since 1.0.0 */ @ConfigurationProperties(prefix = "server", ignoreUnknownFields = true) @@ -440,6 +441,11 @@ public static class Tomcat { */ private final Mbeanregistry mbeanregistry = new Mbeanregistry(); + /** + * Remote Ip Valve configuration. + */ + private final RemoteIpValve remoteIpValve = new RemoteIpValve(); + public int getMaxThreads() { return this.maxThreads; } @@ -495,36 +501,40 @@ public void setBasedir(File basedir) { this.basedir = basedir; } + @DeprecatedConfigurationProperty(replacement = "server.tomcat.remote-ip-valve.internal-proxies") public String getInternalProxies() { - return this.internalProxies; + return this.remoteIpValve.getInternalProxies(); } public void setInternalProxies(String internalProxies) { - this.internalProxies = internalProxies; + this.remoteIpValve.setInternalProxies(internalProxies); } + @DeprecatedConfigurationProperty(replacement = "server.tomcat.remote-ip-valve.protocol-header") public String getProtocolHeader() { - return this.protocolHeader; + return this.remoteIpValve.getProtocolHeader(); } public void setProtocolHeader(String protocolHeader) { - this.protocolHeader = protocolHeader; + this.remoteIpValve.setProtocolHeader(protocolHeader); } + @DeprecatedConfigurationProperty(replacement = "server.tomcat.remote-ip-valve.protocol-header-https-value") public String getProtocolHeaderHttpsValue() { - return this.protocolHeaderHttpsValue; + return this.remoteIpValve.getProtocolHeaderHttpsValue(); } public void setProtocolHeaderHttpsValue(String protocolHeaderHttpsValue) { - this.protocolHeaderHttpsValue = protocolHeaderHttpsValue; + this.remoteIpValve.setProtocolHeaderHttpsValue(protocolHeaderHttpsValue); } + @DeprecatedConfigurationProperty(replacement = "server.tomcat.remote-ip-valve.port-header") public String getPortHeader() { - return this.portHeader; + return this.remoteIpValve.getPortHeader(); } public void setPortHeader(String portHeader) { - this.portHeader = portHeader; + this.remoteIpValve.setPortHeader(portHeader); } public Boolean getRedirectContextRoot() { @@ -543,20 +553,22 @@ public void setUseRelativeRedirects(Boolean useRelativeRedirects) { this.useRelativeRedirects = useRelativeRedirects; } + @DeprecatedConfigurationProperty(replacement = "server.tomcat.remote-ip-valve.remote-ip-header") public String getRemoteIpHeader() { - return this.remoteIpHeader; + return this.remoteIpValve.getRemoteIpHeader(); } public void setRemoteIpHeader(String remoteIpHeader) { - this.remoteIpHeader = remoteIpHeader; + this.remoteIpValve.setRemoteIpHeader(remoteIpHeader); } + @DeprecatedConfigurationProperty(replacement = "server.tomcat.remote-ip-valve.host-header") public String getHostHeader() { - return this.hostHeader; + return this.remoteIpValve.getHostHeader(); } public void setHostHeader(String hostHeader) { - this.hostHeader = hostHeader; + this.remoteIpValve.setHostHeader(hostHeader); } public Charset getUriEncoding() { @@ -639,6 +651,10 @@ public Mbeanregistry getMbeanregistry() { return this.mbeanregistry; } + public RemoteIpValve getRemoteIpValve() { + return this.remoteIpValve; + } + /** * Tomcat access log properties. */ @@ -925,6 +941,96 @@ public void setEnabled(boolean enabled) { } + public static class RemoteIpValve { + + /** + * Name of the HTTP header from which the remote host is extracted. + */ + private String hostHeader = "X-Forwarded-Host"; + + /** + * Regular expression that matches proxies that are to be trusted. + */ + private String internalProxies = "10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|" // 10/8 + + "192\\.168\\.\\d{1,3}\\.\\d{1,3}|" // 192.168/16 + + "169\\.254\\.\\d{1,3}\\.\\d{1,3}|" // 169.254/16 + + "127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|" // 127/8 + + "172\\.1[6-9]{1}\\.\\d{1,3}\\.\\d{1,3}|" // 172.16/12 + + "172\\.2[0-9]{1}\\.\\d{1,3}\\.\\d{1,3}|172\\.3[0-1]{1}\\.\\d{1,3}\\.\\d{1,3}|" // + + "0:0:0:0:0:0:0:1|::1"; + + /** + * Header that holds the incoming protocol, usually named "X-Forwarded-Proto". + */ + private String protocolHeader; + + /** + * Value of the protocol header indicating whether the incoming request uses + * SSL. + */ + private String protocolHeaderHttpsValue = "https"; + + /** + * Name of the HTTP header used to override the original port value. + */ + private String portHeader = "X-Forwarded-Port"; + + /** + * Name of the HTTP header from which the remote IP is extracted. For + * instance, `X-FORWARDED-FOR`. + */ + private String remoteIpHeader; + + public String getHostHeader() { + return this.hostHeader; + } + + public void setHostHeader(String hostHeader) { + this.hostHeader = hostHeader; + } + + public String getInternalProxies() { + return this.internalProxies; + } + + public void setInternalProxies(String internalProxies) { + this.internalProxies = internalProxies; + } + + public String getProtocolHeader() { + return this.protocolHeader; + } + + public void setProtocolHeader(String protocolHeader) { + this.protocolHeader = protocolHeader; + } + + public String getProtocolHeaderHttpsValue() { + return this.protocolHeaderHttpsValue; + } + + public void setProtocolHeaderHttpsValue(String protocolHeaderHttpsValue) { + this.protocolHeaderHttpsValue = protocolHeaderHttpsValue; + } + + public String getPortHeader() { + return this.portHeader; + } + + public void setPortHeader(String portHeader) { + this.portHeader = portHeader; + } + + public String getRemoteIpHeader() { + return this.remoteIpHeader; + } + + public void setRemoteIpHeader(String remoteIpHeader) { + this.remoteIpHeader = remoteIpHeader; + } + + } + } /** diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java index 052a13ba12ee..266e3624cfb3 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java @@ -55,6 +55,7 @@ * @author Andrew McGhie * @author Dirk Deyne * @author Rafiullah Hamedy + * @author Victor Mandujano * @since 2.0.0 */ public class TomcatWebServerFactoryCustomizer @@ -173,8 +174,8 @@ private String joinCharacters(List content) { private void customizeRemoteIpValve(ConfigurableTomcatWebServerFactory factory) { Tomcat tomcatProperties = this.serverProperties.getTomcat(); - String protocolHeader = tomcatProperties.getProtocolHeader(); - String remoteIpHeader = tomcatProperties.getRemoteIpHeader(); + String protocolHeader = tomcatProperties.getRemoteIpValve().getProtocolHeader(); + String remoteIpHeader = tomcatProperties.getRemoteIpValve().getRemoteIpHeader(); // For back compatibility the valve is also enabled if protocol-header is set if (StringUtils.hasText(protocolHeader) || StringUtils.hasText(remoteIpHeader) || getOrDeduceUseForwardHeaders()) { @@ -185,10 +186,10 @@ private void customizeRemoteIpValve(ConfigurableTomcatWebServerFactory factory) } // The internal proxies default to a white list of "safe" internal IP // addresses - valve.setInternalProxies(tomcatProperties.getInternalProxies()); - valve.setHostHeader(tomcatProperties.getHostHeader()); - valve.setPortHeader(tomcatProperties.getPortHeader()); - valve.setProtocolHeaderHttpsValue(tomcatProperties.getProtocolHeaderHttpsValue()); + valve.setInternalProxies(tomcatProperties.getRemoteIpValve().getInternalProxies()); + valve.setHostHeader(tomcatProperties.getRemoteIpValve().getHostHeader()); + valve.setPortHeader(tomcatProperties.getRemoteIpValve().getPortHeader()); + valve.setProtocolHeaderHttpsValue(tomcatProperties.getRemoteIpValve().getProtocolHeaderHttpsValue()); // ... so it's safe to add this valve by default. factory.addEngineValves(valve); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizerTests.java index bde0378c9cd7..2c997e4b19e6 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizerTests.java @@ -53,6 +53,7 @@ * @author Stephane Nicoll * @author Andrew McGhie * @author Rafiullah Hamedy + * @author Victor Mandujano */ class TomcatWebServerFactoryCustomizerTests { @@ -192,6 +193,25 @@ void customRemoteIpValve() { assertThat(remoteIpValve.getInternalProxies()).isEqualTo("192.168.0.1"); } + @Test + void customNewPropertiesForRemoteIpValve() { + bind("server.tomcat.remote-ip-valve.remote-ip-header=x-my-remote-ip-header", + "server.tomcat.remote-ip-valve.protocol-header=x-my-protocol-header", + "server.tomcat.remote-ip-valve.internal-proxies=192.168.0.1", + "server.tomcat.remote-ip-valve.port-header=x-my-forward-port", + "server.tomcat.remote-ip-valve.protocol-header-https-value=On"); + TomcatServletWebServerFactory factory = customizeAndGetFactory(); + assertThat(factory.getEngineValves()).hasSize(1); + Valve valve = factory.getEngineValves().iterator().next(); + assertThat(valve).isInstanceOf(RemoteIpValve.class); + RemoteIpValve remoteIpValve = (RemoteIpValve) valve; + assertThat(remoteIpValve.getProtocolHeader()).isEqualTo("x-my-protocol-header"); + assertThat(remoteIpValve.getProtocolHeaderHttpsValue()).isEqualTo("On"); + assertThat(remoteIpValve.getRemoteIpHeader()).isEqualTo("x-my-remote-ip-header"); + assertThat(remoteIpValve.getPortHeader()).isEqualTo("x-my-forward-port"); + assertThat(remoteIpValve.getInternalProxies()).isEqualTo("192.168.0.1"); + } + @Test void customStaticResourceAllowCaching() { bind("server.tomcat.resource.allow-caching=false"); From 8888f75a41ff59784dfea6ea52d886ac45b1cefb Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 27 Nov 2019 14:30:08 +0100 Subject: [PATCH 27/65] Polish "Add dedicated namespace for RemoteIpValve properties" See gh-18489 --- .../autoconfigure/web/ServerProperties.java | 131 +++++++----------- .../TomcatWebServerFactoryCustomizer.java | 16 +-- .../web/ServerPropertiesTests.java | 6 +- ...TomcatWebServerFactoryCustomizerTests.java | 28 ++-- .../src/main/asciidoc/howto.adoc | 10 +- 5 files changed, 80 insertions(+), 111 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java index 4c4ded84f257..b92f8bc217eb 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java @@ -300,43 +300,6 @@ public static class Tomcat { */ private final Accesslog accesslog = new Accesslog(); - /** - * Regular expression that matches proxies that are to be trusted. - */ - private String internalProxies = "10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|" // 10/8 - + "192\\.168\\.\\d{1,3}\\.\\d{1,3}|" // 192.168/16 - + "169\\.254\\.\\d{1,3}\\.\\d{1,3}|" // 169.254/16 - + "127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|" // 127/8 - + "172\\.1[6-9]{1}\\.\\d{1,3}\\.\\d{1,3}|" // 172.16/12 - + "172\\.2[0-9]{1}\\.\\d{1,3}\\.\\d{1,3}|172\\.3[0-1]{1}\\.\\d{1,3}\\.\\d{1,3}|" // - + "0:0:0:0:0:0:0:1|::1"; - - /** - * Header that holds the incoming protocol, usually named "X-Forwarded-Proto". - */ - private String protocolHeader; - - /** - * Value of the protocol header indicating whether the incoming request uses SSL. - */ - private String protocolHeaderHttpsValue = "https"; - - /** - * Name of the HTTP header used to override the original port value. - */ - private String portHeader = "X-Forwarded-Port"; - - /** - * Name of the HTTP header from which the remote IP is extracted. For instance, - * `X-FORWARDED-FOR`. - */ - private String remoteIpHeader; - - /** - * Name of the HTTP header from which the remote host is extracted. - */ - private String hostHeader = "X-Forwarded-Host"; - /** * Tomcat base directory. If not specified, a temporary directory is used. */ @@ -444,7 +407,7 @@ public static class Tomcat { /** * Remote Ip Valve configuration. */ - private final RemoteIpValve remoteIpValve = new RemoteIpValve(); + private final Remoteip remoteip = new Remoteip(); public int getMaxThreads() { return this.maxThreads; @@ -501,40 +464,58 @@ public void setBasedir(File basedir) { this.basedir = basedir; } - @DeprecatedConfigurationProperty(replacement = "server.tomcat.remote-ip-valve.internal-proxies") + @DeprecatedConfigurationProperty(replacement = "server.tomcat.remoteip.internal-proxies") public String getInternalProxies() { - return this.remoteIpValve.getInternalProxies(); + return this.remoteip.getInternalProxies(); } public void setInternalProxies(String internalProxies) { - this.remoteIpValve.setInternalProxies(internalProxies); + this.remoteip.setInternalProxies(internalProxies); } - @DeprecatedConfigurationProperty(replacement = "server.tomcat.remote-ip-valve.protocol-header") + @DeprecatedConfigurationProperty(replacement = "server.tomcat.remoteip.protocol-header") public String getProtocolHeader() { - return this.remoteIpValve.getProtocolHeader(); + return this.remoteip.getProtocolHeader(); } public void setProtocolHeader(String protocolHeader) { - this.remoteIpValve.setProtocolHeader(protocolHeader); + this.remoteip.setProtocolHeader(protocolHeader); } - @DeprecatedConfigurationProperty(replacement = "server.tomcat.remote-ip-valve.protocol-header-https-value") + @DeprecatedConfigurationProperty(replacement = "server.tomcat.remoteip.protocol-header-https-value") public String getProtocolHeaderHttpsValue() { - return this.remoteIpValve.getProtocolHeaderHttpsValue(); + return this.remoteip.getProtocolHeaderHttpsValue(); } public void setProtocolHeaderHttpsValue(String protocolHeaderHttpsValue) { - this.remoteIpValve.setProtocolHeaderHttpsValue(protocolHeaderHttpsValue); + this.remoteip.setProtocolHeaderHttpsValue(protocolHeaderHttpsValue); } - @DeprecatedConfigurationProperty(replacement = "server.tomcat.remote-ip-valve.port-header") + @DeprecatedConfigurationProperty(replacement = "server.tomcat.remoteip.host-header") + public String getHostHeader() { + return this.remoteip.getHostHeader(); + } + + public void setHostHeader(String hostHeader) { + this.remoteip.setHostHeader(hostHeader); + } + + @DeprecatedConfigurationProperty(replacement = "server.tomcat.remote.port-header") public String getPortHeader() { - return this.remoteIpValve.getPortHeader(); + return this.remoteip.getPortHeader(); } public void setPortHeader(String portHeader) { - this.remoteIpValve.setPortHeader(portHeader); + this.remoteip.setPortHeader(portHeader); + } + + @DeprecatedConfigurationProperty(replacement = "server.tomcat.remoteip.remote-ip-header") + public String getRemoteIpHeader() { + return this.remoteip.getRemoteIpHeader(); + } + + public void setRemoteIpHeader(String remoteIpHeader) { + this.remoteip.setRemoteIpHeader(remoteIpHeader); } public Boolean getRedirectContextRoot() { @@ -553,24 +534,6 @@ public void setUseRelativeRedirects(Boolean useRelativeRedirects) { this.useRelativeRedirects = useRelativeRedirects; } - @DeprecatedConfigurationProperty(replacement = "server.tomcat.remote-ip-valve.remote-ip-header") - public String getRemoteIpHeader() { - return this.remoteIpValve.getRemoteIpHeader(); - } - - public void setRemoteIpHeader(String remoteIpHeader) { - this.remoteIpValve.setRemoteIpHeader(remoteIpHeader); - } - - @DeprecatedConfigurationProperty(replacement = "server.tomcat.remote-ip-valve.host-header") - public String getHostHeader() { - return this.remoteIpValve.getHostHeader(); - } - - public void setHostHeader(String hostHeader) { - this.remoteIpValve.setHostHeader(hostHeader); - } - public Charset getUriEncoding() { return this.uriEncoding; } @@ -651,8 +614,8 @@ public Mbeanregistry getMbeanregistry() { return this.mbeanregistry; } - public RemoteIpValve getRemoteIpValve() { - return this.remoteIpValve; + public Remoteip getRemoteip() { + return this.remoteip; } /** @@ -941,12 +904,7 @@ public void setEnabled(boolean enabled) { } - public static class RemoteIpValve { - - /** - * Name of the HTTP header from which the remote host is extracted. - */ - private String hostHeader = "X-Forwarded-Host"; + public static class Remoteip { /** * Regular expression that matches proxies that are to be trusted. @@ -970,6 +928,11 @@ public static class RemoteIpValve { */ private String protocolHeaderHttpsValue = "https"; + /** + * Name of the HTTP header from which the remote host is extracted. + */ + private String hostHeader = "X-Forwarded-Host"; + /** * Name of the HTTP header used to override the original port value. */ @@ -981,14 +944,6 @@ public static class RemoteIpValve { */ private String remoteIpHeader; - public String getHostHeader() { - return this.hostHeader; - } - - public void setHostHeader(String hostHeader) { - this.hostHeader = hostHeader; - } - public String getInternalProxies() { return this.internalProxies; } @@ -1009,6 +964,14 @@ public String getProtocolHeaderHttpsValue() { return this.protocolHeaderHttpsValue; } + public String getHostHeader() { + return this.hostHeader; + } + + public void setHostHeader(String hostHeader) { + this.hostHeader = hostHeader; + } + public void setProtocolHeaderHttpsValue(String protocolHeaderHttpsValue) { this.protocolHeaderHttpsValue = protocolHeaderHttpsValue; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java index 266e3624cfb3..ed7d034b633a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java @@ -31,8 +31,8 @@ import org.springframework.boot.autoconfigure.web.ErrorProperties; import org.springframework.boot.autoconfigure.web.ErrorProperties.IncludeStacktrace; import org.springframework.boot.autoconfigure.web.ServerProperties; -import org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat; import org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat.Accesslog; +import org.springframework.boot.autoconfigure.web.ServerProperties.Tomcat.Remoteip; import org.springframework.boot.cloud.CloudPlatform; import org.springframework.boot.context.properties.PropertyMapper; import org.springframework.boot.web.embedded.tomcat.ConfigurableTomcatWebServerFactory; @@ -173,9 +173,9 @@ private String joinCharacters(List content) { } private void customizeRemoteIpValve(ConfigurableTomcatWebServerFactory factory) { - Tomcat tomcatProperties = this.serverProperties.getTomcat(); - String protocolHeader = tomcatProperties.getRemoteIpValve().getProtocolHeader(); - String remoteIpHeader = tomcatProperties.getRemoteIpValve().getRemoteIpHeader(); + Remoteip remoteIpProperties = this.serverProperties.getTomcat().getRemoteip(); + String protocolHeader = remoteIpProperties.getProtocolHeader(); + String remoteIpHeader = remoteIpProperties.getRemoteIpHeader(); // For back compatibility the valve is also enabled if protocol-header is set if (StringUtils.hasText(protocolHeader) || StringUtils.hasText(remoteIpHeader) || getOrDeduceUseForwardHeaders()) { @@ -186,10 +186,10 @@ private void customizeRemoteIpValve(ConfigurableTomcatWebServerFactory factory) } // The internal proxies default to a white list of "safe" internal IP // addresses - valve.setInternalProxies(tomcatProperties.getRemoteIpValve().getInternalProxies()); - valve.setHostHeader(tomcatProperties.getRemoteIpValve().getHostHeader()); - valve.setPortHeader(tomcatProperties.getRemoteIpValve().getPortHeader()); - valve.setProtocolHeaderHttpsValue(tomcatProperties.getRemoteIpValve().getProtocolHeaderHttpsValue()); + valve.setInternalProxies(remoteIpProperties.getInternalProxies()); + valve.setHostHeader(remoteIpProperties.getHostHeader()); + valve.setPortHeader(remoteIpProperties.getPortHeader()); + valve.setProtocolHeaderHttpsValue(remoteIpProperties.getProtocolHeaderHttpsValue()); // ... so it's safe to add this valve by default. factory.addEngineValves(valve); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java index 17b82914c925..96d91dd1720f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/ServerPropertiesTests.java @@ -125,9 +125,9 @@ void testTomcatBinding() { map.put("server.tomcat.accesslog.rename-on-rotate", "true"); map.put("server.tomcat.accesslog.ipv6Canonical", "true"); map.put("server.tomcat.accesslog.request-attributes-enabled", "true"); - map.put("server.tomcat.protocol-header", "X-Forwarded-Protocol"); - map.put("server.tomcat.remote-ip-header", "Remote-Ip"); - map.put("server.tomcat.internal-proxies", "10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"); + map.put("server.tomcat.remoteip.protocol-header", "X-Forwarded-Protocol"); + map.put("server.tomcat.remoteip.remote-ip-header", "Remote-Ip"); + map.put("server.tomcat.remoteip.internal-proxies", "10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"); map.put("server.tomcat.background-processor-delay", "10"); map.put("server.tomcat.relaxed-path-chars", "|,<"); map.put("server.tomcat.relaxed-query-chars", "^ , | "); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizerTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizerTests.java index 2c997e4b19e6..b2798b9cc49d 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizerTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizerTests.java @@ -178,9 +178,12 @@ void customMaxSwallowSize() { @Test void customRemoteIpValve() { - bind("server.tomcat.remote-ip-header=x-my-remote-ip-header", - "server.tomcat.protocol-header=x-my-protocol-header", "server.tomcat.internal-proxies=192.168.0.1", - "server.tomcat.port-header=x-my-forward-port", "server.tomcat.protocol-header-https-value=On"); + bind("server.tomcat.remoteip.remote-ip-header=x-my-remote-ip-header", + "server.tomcat.remoteip.protocol-header=x-my-protocol-header", + "server.tomcat.remoteip.internal-proxies=192.168.0.1", + "server.tomcat.remoteip.host-header=x-my-forward-host", + "server.tomcat.remoteip.port-header=x-my-forward-port", + "server.tomcat.remoteip.protocol-header-https-value=On"); TomcatServletWebServerFactory factory = customizeAndGetFactory(); assertThat(factory.getEngineValves()).hasSize(1); Valve valve = factory.getEngineValves().iterator().next(); @@ -189,17 +192,18 @@ void customRemoteIpValve() { assertThat(remoteIpValve.getProtocolHeader()).isEqualTo("x-my-protocol-header"); assertThat(remoteIpValve.getProtocolHeaderHttpsValue()).isEqualTo("On"); assertThat(remoteIpValve.getRemoteIpHeader()).isEqualTo("x-my-remote-ip-header"); + assertThat(remoteIpValve.getHostHeader()).isEqualTo("x-my-forward-host"); assertThat(remoteIpValve.getPortHeader()).isEqualTo("x-my-forward-port"); assertThat(remoteIpValve.getInternalProxies()).isEqualTo("192.168.0.1"); } @Test - void customNewPropertiesForRemoteIpValve() { - bind("server.tomcat.remote-ip-valve.remote-ip-header=x-my-remote-ip-header", - "server.tomcat.remote-ip-valve.protocol-header=x-my-protocol-header", - "server.tomcat.remote-ip-valve.internal-proxies=192.168.0.1", - "server.tomcat.remote-ip-valve.port-header=x-my-forward-port", - "server.tomcat.remote-ip-valve.protocol-header-https-value=On"); + @Deprecated + void customRemoteIpValveWithDeprecatedProperties() { + bind("server.tomcat.remote-ip-header=x-my-remote-ip-header", + "server.tomcat.protocol-header=x-my-protocol-header", "server.tomcat.internal-proxies=192.168.0.1", + "server.tomcat.host-header=x-my-forward-host", "server.tomcat.port-header=x-my-forward-port", + "server.tomcat.protocol-header-https-value=On"); TomcatServletWebServerFactory factory = customizeAndGetFactory(); assertThat(factory.getEngineValves()).hasSize(1); Valve valve = factory.getEngineValves().iterator().next(); @@ -208,6 +212,7 @@ void customNewPropertiesForRemoteIpValve() { assertThat(remoteIpValve.getProtocolHeader()).isEqualTo("x-my-protocol-header"); assertThat(remoteIpValve.getProtocolHeaderHttpsValue()).isEqualTo("On"); assertThat(remoteIpValve.getRemoteIpHeader()).isEqualTo("x-my-remote-ip-header"); + assertThat(remoteIpValve.getHostHeader()).isEqualTo("x-my-forward-host"); assertThat(remoteIpValve.getPortHeader()).isEqualTo("x-my-forward-port"); assertThat(remoteIpValve.getInternalProxies()).isEqualTo("192.168.0.1"); } @@ -257,7 +262,8 @@ void deduceUseForwardHeaders() { @Test void defaultRemoteIpValve() { // Since 1.1.7 you need to specify at least the protocol - bind("server.tomcat.protocol-header=X-Forwarded-Proto", "server.tomcat.remote-ip-header=X-Forwarded-For"); + bind("server.tomcat.remoteip.protocol-header=X-Forwarded-Proto", + "server.tomcat.remoteip.remote-ip-header=X-Forwarded-For"); testRemoteIpValveConfigured(); } @@ -297,7 +303,7 @@ void defaultBackgroundProcessorDelay() { @Test void disableRemoteIpValve() { - bind("server.tomcat.remote-ip-header=", "server.tomcat.protocol-header="); + bind("server.tomcat.remoteip.remote-ip-header=", "server.tomcat.remoteip.protocol-header="); TomcatServletWebServerFactory factory = customizeAndGetFactory(); assertThat(factory.getEngineValves()).isEmpty(); } diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/howto.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/howto.adoc index f9949711a1da..1e496f694521 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/howto.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/howto.adoc @@ -804,8 +804,8 @@ If you use Tomcat, you can additionally configure the names of the headers used [indent=0] ---- - server.tomcat.remote-ip-header=x-your-remote-ip-header - server.tomcat.protocol-header=x-your-protocol-header + server.tomcat.remoteip.remote-ip-header=x-your-remote-ip-header + server.tomcat.remoteip.protocol-header=x-your-protocol-header ---- Tomcat is also configured with a default regular expression that matches internal proxies that are to be trusted. @@ -814,7 +814,7 @@ You can customize the valve's configuration by adding an entry to `application.p [indent=0] ---- - server.tomcat.internal-proxies=192\\.168\\.\\d{1,3}\\.\\d{1,3} + server.tomcat.remoteip.internal-proxies=192\\.168\\.\\d{1,3}\\.\\d{1,3} ---- NOTE: The double backslashes are required only when you use a properties file for configuration. @@ -2203,8 +2203,8 @@ You can switch on the valve by adding some entries to `application.properties`, [source,properties,indent=0,configprops] ---- - server.tomcat.remote-ip-header=x-forwarded-for - server.tomcat.protocol-header=x-forwarded-proto + server.tomcat.remoteip.remote-ip-header=x-forwarded-for + server.tomcat.remoteip.protocol-header=x-forwarded-proto ---- (The presence of either of those properties switches on the valve. From c3786e727fc6bb80deb0f830a6fc2537de73e3a1 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 27 Nov 2019 18:41:32 +0100 Subject: [PATCH 28/65] Upgrade to Reactor Dysprosium-SR2 Closes gh-19054 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 6dbff6c54f49..30a808e82d62 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -171,7 +171,7 @@ 2.3.2 4.2.1 5.7.3 - Dysprosium-BUILD-SNAPSHOT + Dysprosium-SR2 3.3.0 1.0.3 1.0.0-RC5 From c6c03e89a47753ee1267b66d090a2a2c88351962 Mon Sep 17 00:00:00 2001 From: dreis2211 Date: Fri, 29 Nov 2019 10:12:50 +0100 Subject: [PATCH 29/65] Remove code that is deprecated since 2.1.x See gh-19189 --- ...ientDependsOnBeanFactoryPostProcessor.java | 12 ----- ...ientDependsOnBeanFactoryPostProcessor.java | 12 ----- .../servlet/JerseyRequestMatcherProvider.java | 44 ------------------- 3 files changed, 68 deletions(-) delete mode 100644 spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/JerseyRequestMatcherProvider.java diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoClientDependsOnBeanFactoryPostProcessor.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoClientDependsOnBeanFactoryPostProcessor.java index 1abe21203252..5b0288ff8c07 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoClientDependsOnBeanFactoryPostProcessor.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoClientDependsOnBeanFactoryPostProcessor.java @@ -36,18 +36,6 @@ @Order(Ordered.LOWEST_PRECEDENCE) public class MongoClientDependsOnBeanFactoryPostProcessor extends AbstractDependsOnBeanFactoryPostProcessor { - /** - * Creates a new {@code MongoClientDependsOnBeanFactoryPostProcessor} that will set up - * dependencies upon beans with the given names. - * @param dependsOn names of the beans to depend upon - * @deprecated since 2.1.7 in favor of - * {@link #MongoClientDependsOnBeanFactoryPostProcessor(Class...)} - */ - @Deprecated - public MongoClientDependsOnBeanFactoryPostProcessor(String... dependsOn) { - super(MongoClient.class, MongoClientFactoryBean.class, dependsOn); - } - /** * Creates a new {@code MongoClientDependsOnBeanFactoryPostProcessor} that will set up * dependencies upon beans with the given types. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/ReactiveStreamsMongoClientDependsOnBeanFactoryPostProcessor.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/ReactiveStreamsMongoClientDependsOnBeanFactoryPostProcessor.java index fa236dca4855..0b0be21434f9 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/ReactiveStreamsMongoClientDependsOnBeanFactoryPostProcessor.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/ReactiveStreamsMongoClientDependsOnBeanFactoryPostProcessor.java @@ -37,18 +37,6 @@ public class ReactiveStreamsMongoClientDependsOnBeanFactoryPostProcessor extends AbstractDependsOnBeanFactoryPostProcessor { - /** - * Creates a new {@code ReactiveStreamsMongoClientDependsOnBeanFactoryPostProcessor} - * that will set up dependencies upon beans with the given names. - * @param dependsOn names of the beans to depend upon - * @deprecated since 2.1.7 in favor of - * {@link #ReactiveStreamsMongoClientDependsOnBeanFactoryPostProcessor(Class...)} - */ - @Deprecated - public ReactiveStreamsMongoClientDependsOnBeanFactoryPostProcessor(String... dependsOn) { - super(MongoClient.class, ReactiveMongoClientFactoryBean.class, dependsOn); - } - /** * Creates a new {@code ReactiveStreamsMongoClientDependsOnBeanFactoryPostProcessor} * that will set up dependencies upon beans with the given types. diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/JerseyRequestMatcherProvider.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/JerseyRequestMatcherProvider.java deleted file mode 100644 index c25210b6cc00..000000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/servlet/JerseyRequestMatcherProvider.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2012-2019 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.security.servlet; - -import org.springframework.boot.autoconfigure.web.servlet.JerseyApplicationPath; -import org.springframework.security.web.util.matcher.AntPathRequestMatcher; -import org.springframework.security.web.util.matcher.RequestMatcher; - -/** - * {@link RequestMatcherProvider} that provides an {@link AntPathRequestMatcher} that can - * be used for Jersey applications. - * - * @author Madhura Bhave - * @since 2.0.7 - * @deprecated since 2.1.8 in favor of {@link AntPathRequestMatcher} - */ -@Deprecated -public class JerseyRequestMatcherProvider implements RequestMatcherProvider { - - private final JerseyApplicationPath jerseyApplicationPath; - - public JerseyRequestMatcherProvider(JerseyApplicationPath jerseyApplicationPath) { - this.jerseyApplicationPath = jerseyApplicationPath; - } - - @Override - public RequestMatcher getRequestMatcher(String pattern) { - return new AntPathRequestMatcher(this.jerseyApplicationPath.getRelativePath(pattern)); - } - -} From 48bf478d2c77521373476ea2e031b505c0a5f5fa Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Tue, 3 Dec 2019 12:08:07 +0100 Subject: [PATCH 30/65] Upgrade to Spring Framework 5.2.2.RELEASE Closes gh-19076 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 30a808e82d62..254f401c9ccd 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -189,7 +189,7 @@ 4.2.0.RELEASE 2.0.6.RELEASE Moore-BUILD-SNAPSHOT - 5.2.2.BUILD-SNAPSHOT + 5.2.2.RELEASE 1.0.1.RELEASE 5.2.1.RELEASE 2.3.3.RELEASE From d5c8639cda7c585fbabae2778cacdef5bd2ae03b Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 17:51:30 +0000 Subject: [PATCH 31/65] Upgrade to Spring Data Moore-SR3 Closes gh-19075 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 254f401c9ccd..3d60fe9d296b 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -188,7 +188,7 @@ 2.2.1.RELEASE 4.2.0.RELEASE 2.0.6.RELEASE - Moore-BUILD-SNAPSHOT + Moore-SR3 5.2.2.RELEASE 1.0.1.RELEASE 5.2.1.RELEASE From 86cd332741638d849b71510f1f033e9058bc844d Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 17:53:32 +0000 Subject: [PATCH 32/65] Upgrade to Spring Amqp 2.2.2.RELEASE Closes gh-19224 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 3d60fe9d296b..6a72417bf9e4 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -185,7 +185,7 @@ 1.7.29 1.25 8.2.0 - 2.2.1.RELEASE + 2.2.2.RELEASE 4.2.0.RELEASE 2.0.6.RELEASE Moore-SR3 From d0ffa8b6546bf42546804505cd94d774344a63f4 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 17:53:34 +0000 Subject: [PATCH 33/65] Upgrade to Spring Hateoas 1.0.2.RELEASE Closes gh-19225 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 6a72417bf9e4..a85d91e551fc 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -190,7 +190,7 @@ 2.0.6.RELEASE Moore-SR3 5.2.2.RELEASE - 1.0.1.RELEASE + 1.0.2.RELEASE 5.2.1.RELEASE 2.3.3.RELEASE 2.3.2.RELEASE From 94709733da911a4653fcf62e40d850d8cac035f4 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 17:53:35 +0000 Subject: [PATCH 34/65] Upgrade to Spring Kafka 2.3.4.RELEASE Closes gh-19226 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index a85d91e551fc..66100f2dd826 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -192,7 +192,7 @@ 5.2.2.RELEASE 1.0.2.RELEASE 5.2.1.RELEASE - 2.3.3.RELEASE + 2.3.4.RELEASE 2.3.2.RELEASE 2.0.4.RELEASE 1.2.4.RELEASE From 85b9c9cea64835ea5b6249c371bc0d082989e6ee Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:56:36 +0000 Subject: [PATCH 35/65] Upgrade to Spring Integration 5.2.2.RELEASE Closes gh-19277 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 66100f2dd826..335adedbfdcf 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -191,7 +191,7 @@ Moore-SR3 5.2.2.RELEASE 1.0.2.RELEASE - 5.2.1.RELEASE + 5.2.2.RELEASE 2.3.4.RELEASE 2.3.2.RELEASE 2.0.4.RELEASE From 11d5fcb366f62380f03c9eec5b73e9a9f49dd7d3 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:52:55 +0000 Subject: [PATCH 36/65] Upgrade to Couchbase Client 2.7.11 Closes gh-19248 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 335adedbfdcf..0ba3e3de6947 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -52,7 +52,7 @@ 3.9 1.6 2.7.0 - 2.7.9 + 2.7.11 2.1.0 1.0.8.RELEASE 11.5.0.0 From 18489bea8148eba850557ed305932026c9473c3f Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:52:57 +0000 Subject: [PATCH 37/65] Upgrade to Jackson 2.10.1 Closes gh-19249 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 0ba3e3de6947..f4d950dbb32a 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -83,7 +83,7 @@ 9.4.16.Final 2.16 - 2.10.0 + 2.10.1 ${jackson.version} 1.2.1 1.3.5 From 4d47cf65d58474424bb262f008981d3dfc9cef22 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:52:58 +0000 Subject: [PATCH 38/65] Upgrade to Appengine Sdk 1.9.77 Closes gh-19250 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index f4d950dbb32a..1df76bbbbc50 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -36,7 +36,7 @@ 5.15.10 2.7.7 - 1.9.76 + 1.9.77 2.10.1 1.9.4 3.14.0 From be903123f52a866be0d0a38e9dcdd0b551a7da70 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:00 +0000 Subject: [PATCH 39/65] Upgrade to Querydsl 4.2.2 Closes gh-19251 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 1df76bbbbc50..66330b0e6dca 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -169,7 +169,7 @@ 42.2.8 0.7.0 2.3.2 - 4.2.1 + 4.2.2 5.7.3 Dysprosium-SR2 3.3.0 From c253052a4dd6d8a98a6321124cf6e2de9ac65959 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:01 +0000 Subject: [PATCH 40/65] Upgrade to Unboundid Ldapsdk 4.0.13 Closes gh-19252 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 66330b0e6dca..34eac9a86220 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -208,7 +208,7 @@ 2.0.1 3.0.4.RELEASE 9.0.27 - 4.0.12 + 4.0.13 2.0.27.Final 3325375 0.42 From 5729ea3fe3a08f5ff887bc45880424c22871d023 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:02 +0000 Subject: [PATCH 41/65] Upgrade to Netty Tcnative 2.0.28.Final Closes gh-19253 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 34eac9a86220..e8b20a37b603 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -161,7 +161,7 @@ 1.9.22 3.2.2 4.1.43.Final - 2.0.26.Final + 2.0.28.Final 1.1.0 19.3.0.0 3.14.4 From 327a17bebaa0c46433905eb6528dbae01a886f83 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:04 +0000 Subject: [PATCH 42/65] Upgrade to Prometheus Pushgateway 0.8.0 Closes gh-19254 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index e8b20a37b603..b09583b6eed0 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -167,7 +167,7 @@ 3.14.4 1.1.0 42.2.8 - 0.7.0 + 0.8.0 2.3.2 4.2.2 5.7.3 From 23d0ef079c2b5180deea0597d67b41f241e96f79 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:05 +0000 Subject: [PATCH 43/65] Upgrade to Rxjava2 2.2.15 Closes gh-19255 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index b09583b6eed0..e36b93e3b24a 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -177,7 +177,7 @@ 1.0.0-RC5 1.3.8 1.2.1 - 2.2.14 + 2.2.15 3.141.59 2.36.0 4.4.1 From ec71009b88764d404910086effa3923864301d79 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:07 +0000 Subject: [PATCH 44/65] Upgrade to Undertow 2.0.28.Final Closes gh-19256 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index e36b93e3b24a..31e5e5baf856 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -209,7 +209,7 @@ 3.0.4.RELEASE 9.0.27 4.0.13 - 2.0.27.Final + 2.0.28.Final 3325375 0.42 1.6.3 From 2614f641f8b3e8f2032bb55eff1b8bb286bb2e11 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:08 +0000 Subject: [PATCH 45/65] Upgrade to Byte Buddy 1.10.4 Closes gh-19257 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 31e5e5baf856..2a009d79f6fb 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -43,7 +43,7 @@ 4.0.6 4.0.1 2.1.4 - 1.10.2 + 1.10.4 2.8.0 3.7.2 1.5.1 From b392fa4737f20a8b30b25c809bb0f711857e4f71 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:10 +0000 Subject: [PATCH 46/65] Upgrade to Activemq 5.15.11 Closes gh-19258 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 2a009d79f6fb..23ad996df38d 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -34,7 +34,7 @@ ${basedir}/../.. - 5.15.10 + 5.15.11 2.7.7 1.9.77 2.10.1 From 699c6840864568be31edd08912c0cdb56f477aca Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:11 +0000 Subject: [PATCH 47/65] Upgrade to Johnzon Jsonb 1.2.2 Closes gh-19259 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 23ad996df38d..eedc5b0fbffa 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -133,7 +133,7 @@ 2.10.5 1.6.2 - 1.2.1 + 1.2.2 ${johnzon-jsonb.version} 3.12.3 1.5.0 From 90a46c781798dfa28225f6e59254f779d8a6422a Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:12 +0000 Subject: [PATCH 48/65] Upgrade to Tomcat 9.0.29 Closes gh-19260 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index eedc5b0fbffa..a274ea37142f 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -207,7 +207,7 @@ 2.4.1 2.0.1 3.0.4.RELEASE - 9.0.27 + 9.0.29 4.0.13 2.0.28.Final 3325375 From c3d74886525517a06aa05db6d9e0db6530f068c7 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:13 +0000 Subject: [PATCH 49/65] Upgrade to Aspectj 1.9.5 Closes gh-19261 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index a274ea37142f..06928969d68b 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -38,7 +38,7 @@ 2.7.7 1.9.77 2.10.1 - 1.9.4 + 1.9.5 3.14.0 4.0.6 4.0.1 From 1e3b701cbb96a284bca81c8f58e761cc56621d4a Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:15 +0000 Subject: [PATCH 50/65] Upgrade to Jetty 9.4.24.v20191120 Closes gh-19262 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 06928969d68b..bc7c09f56995 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -124,7 +124,7 @@ 3.1.0 2.29.1 6.3.1 - 9.4.22.v20191022 + 9.4.24.v20191120 2.2.0.v201112011158 8.5.40 1.0.3 From c0972820e70087bde7a387c8106c1aca6b6b8e96 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:16 +0000 Subject: [PATCH 51/65] Upgrade to Jetty Reactive Httpclient 1.1.0 Closes gh-19263 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index bc7c09f56995..be3696bf00bb 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -127,7 +127,7 @@ 9.4.24.v20191120 2.2.0.v201112011158 8.5.40 - 1.0.3 + 1.1.0 1.15 4.5.2 2.10.5 From ecc970f3acdacc8c92823b67d1a3e7006ed9aee6 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:18 +0000 Subject: [PATCH 52/65] Upgrade to Elasticsearch 6.8.5 Closes gh-19264 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index be3696bf00bb..ad433a450b62 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -63,7 +63,7 @@ 2.2.0 6.0.8 2.3.29 - 6.8.4 + 6.8.5 3.0.3 2.3.2 2.5.8 From 836749ee329d4afe06933e0a9b13fa51d8dd34ac Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:19 +0000 Subject: [PATCH 53/65] Upgrade to Jaybird 3.0.8 Closes gh-19265 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index ad433a450b62..c480c8bd05c8 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -117,7 +117,7 @@ 2.0.1.Final 1.1 1.2.0 - 3.0.6 + 3.0.8 3.4.1.Final 7.6.0.Final 2.0.6 From a826fabd3f0668292bedcc2ddd6f3003025dde95 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:22 +0000 Subject: [PATCH 54/65] Upgrade to Hibernate 5.4.9.Final Closes gh-19267 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index c480c8bd05c8..b6fe78d89c0b 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -72,7 +72,7 @@ 2.2 3.12.4 1.3.2 - 5.4.8.Final + 5.4.9.Final 6.1.0.Final 3.4.1 2.5.0 From 0c1b258c1ee9385ed216c188e252378e6525759a Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:23 +0000 Subject: [PATCH 55/65] Upgrade to Kotlin 1.3.61 Closes gh-19268 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index b6fe78d89c0b..01338ab31807 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -143,7 +143,7 @@ 4.12 5.5.2 2.3.1 - 1.3.60 + 1.3.61 1.3.2 5.2.1.RELEASE 3.8.0 From a87ddab37fa8f304e90898bcfe7ee46010d83f0b Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:25 +0000 Subject: [PATCH 56/65] Upgrade to Liquibase 3.8.2 Closes gh-19269 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 01338ab31807..73b74f891cbb 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -146,7 +146,7 @@ 1.3.61 1.3.2 5.2.1.RELEASE - 3.8.0 + 3.8.2 2.12.1 1.2.3 1.18.10 From 5cab3592a0b62617cbd2ae21febd6652b08c538d Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:26 +0000 Subject: [PATCH 57/65] Upgrade to Mariadb 2.5.2 Closes gh-19270 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 73b74f891cbb..cb9284ee30d7 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -150,7 +150,7 @@ 2.12.1 1.2.3 1.18.10 - 2.5.1 + 2.5.2 1.3.1 1.9.12 3.1.0 From e9da6d343de0b6b7ce11acf660879cd3ea87e744 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:27 +0000 Subject: [PATCH 58/65] Upgrade to Mockito 3.2.0 Closes gh-19271 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index cb9284ee30d7..0606feebeedc 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -153,7 +153,7 @@ 2.5.2 1.3.1 1.9.12 - 3.1.0 + 3.2.0 1.12.0 3.11.2 7.4.1.jre8 From 08db5205665265ce21174c2b2662df57c18c5c59 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:29 +0000 Subject: [PATCH 59/65] Upgrade to Jetty El 8.5.49 Closes gh-19272 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 0606feebeedc..dddd5817c82c 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -126,7 +126,7 @@ 6.3.1 9.4.24.v20191120 2.2.0.v201112011158 - 8.5.40 + 8.5.49 1.1.0 1.15 4.5.2 From d8ead5bcf7661a9b5459ca6fe0904e30b2915359 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:30 +0000 Subject: [PATCH 60/65] Upgrade to Neo4j Ogm 3.2.3 Closes gh-19273 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index dddd5817c82c..fe29cc7cda60 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -159,7 +159,7 @@ 7.4.1.jre8 8.0.18 1.9.22 - 3.2.2 + 3.2.3 4.1.43.Final 2.0.28.Final 1.1.0 From 896a048d9e4c55eebd0bc871dc8641290be86244 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:31 +0000 Subject: [PATCH 61/65] Upgrade to Spring Cloud Connectors 2.0.7.RELEASE Closes gh-19274 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index fe29cc7cda60..ce472acb660b 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -187,7 +187,7 @@ 8.2.0 2.2.2.RELEASE 4.2.0.RELEASE - 2.0.6.RELEASE + 2.0.7.RELEASE Moore-SR3 5.2.2.RELEASE 1.0.2.RELEASE From edb1f9e03add815cb3a926ff8241785ed618dc41 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:33 +0000 Subject: [PATCH 62/65] Upgrade to Webjars Locator Core 0.43 Closes gh-19275 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index ce472acb660b..5094897d2a8d 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -211,7 +211,7 @@ 4.0.13 2.0.28.Final 3325375 - 0.42 + 0.43 1.6.3 2.6.3 From d3a30dc28f4ece4c732fe3a263f0b87cd80c0adc Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 4 Dec 2019 19:53:34 +0000 Subject: [PATCH 63/65] Upgrade to Maven Enforcer Plugin 3.0.0-M3 Closes gh-19276 --- spring-boot-project/spring-boot-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index 5094897d2a8d..8ff8ac21ce80 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -224,7 +224,7 @@ 3.8.1 3.1.1 2.8.2 - 3.0.0-M2 + 3.0.0-M3 2.22.2 2.5.2 3.2.1 From 4c447f754ac6c30cacf57a05ca6a0da6f27aacad Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 4 Dec 2019 18:33:57 -0800 Subject: [PATCH 64/65] Update version number in oomph setup file Change version from 2.2.x to 2.3.x. --- eclipse/spring-boot-project.setup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eclipse/spring-boot-project.setup b/eclipse/spring-boot-project.setup index ed2e998a003a..4bd5d7e2b375 100644 --- a/eclipse/spring-boot-project.setup +++ b/eclipse/spring-boot-project.setup @@ -11,8 +11,8 @@ xmlns:setup.workingsets="http://www.eclipse.org/oomph/setup/workingsets/1.0" xmlns:workingsets="http://www.eclipse.org/oomph/workingsets/1.0" xsi:schemaLocation="http://www.eclipse.org/oomph/setup/jdt/1.0 https://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/models/JDT.ecore http://www.eclipse.org/oomph/setup/maven/1.0 https://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/models/Maven.ecore http://www.eclipse.org/oomph/predicates/1.0 https://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/models/Predicates.ecore http://www.eclipse.org/oomph/setup/workingsets/1.0 https://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/models/SetupWorkingSets.ecore http://www.eclipse.org/oomph/workingsets/1.0 https://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/models/WorkingSets.ecore" - name="spring.boot.2.2.x" - label="Spring Boot 2.2.x"> + name="spring.boot.2.3.x" + label="Spring Boot 2.3.x"> Date: Thu, 5 Dec 2019 14:51:21 +0800 Subject: [PATCH 65/65] Delete useless judgment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Delete useless judgment,Because validationQuery must not be null or “” or “ ” --- .../jdbc/DataSourceHealthIndicator.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/jdbc/DataSourceHealthIndicator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/jdbc/DataSourceHealthIndicator.java index 25cd37e82deb..cb784c854b8a 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/jdbc/DataSourceHealthIndicator.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/jdbc/DataSourceHealthIndicator.java @@ -107,17 +107,16 @@ private void doDataSourceHealthCheck(Health.Builder builder) throws Exception { String product = getProduct(); builder.up().withDetail("database", product); String validationQuery = getValidationQuery(product); - if (StringUtils.hasText(validationQuery)) { - try { - // Avoid calling getObject as it breaks MySQL on Java 7 - List results = this.jdbcTemplate.query(validationQuery, new SingleColumnRowMapper()); - Object result = DataAccessUtils.requiredSingleResult(results); - builder.withDetail("result", result); - } - finally { - builder.withDetail("validationQuery", validationQuery); - } + try { + // Avoid calling getObject as it breaks MySQL on Java 7 + List results = this.jdbcTemplate.query(validationQuery, new SingleColumnRowMapper()); + Object result = DataAccessUtils.requiredSingleResult(results); + builder.withDetail("result", result); + } + finally { + builder.withDetail("validationQuery", validationQuery); } + } private String getProduct() {