From 7ea72e72d9562b0815efe47bf2fd588633978e3b Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Thu, 26 Jan 2023 18:27:59 +0100 Subject: [PATCH] Update Projects API URL for fetching Spring Boot metadata This commit updates (again) the URL used by Initializr clients to fetch metadata for the Spring Boot project. Since the Sagan application is being retired, this API has now migrated to https://api.spring.io See gh-1369 --- .../src/main/asciidoc/configuration-guide.adoc | 2 +- .../metadata/InitializrConfiguration.java | 2 +- initializr-service-sample/README.adoc | 2 +- .../support/SpringBootMetadataReaderTests.java | 4 ++-- .../resources/metadata/config/test-default.json | 2 +- .../springio/spring-boot-invalid-version.json | 6 +++--- .../springio/spring-boot-no-default.json | 16 ++++++++-------- .../resources/metadata/springio/spring-boot.json | 16 ++++++++-------- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/initializr-docs/src/main/asciidoc/configuration-guide.adoc b/initializr-docs/src/main/asciidoc/configuration-guide.adoc index 2041173e..3bed9867 100644 --- a/initializr-docs/src/main/asciidoc/configuration-guide.adoc +++ b/initializr-docs/src/main/asciidoc/configuration-guide.adoc @@ -1153,7 +1153,7 @@ automatically: [[create-instance-advanced-config-caching]] === Caching configuration If you use the service, you'll notice that the logs have lots of entries with the message -`Fetching boot metadata from https://spring.io/api/projects/spring-boot/releases`. To avoid +`Fetching boot metadata from https://api.spring.io/projects/spring-boot/releases`. To avoid checking for the latest Spring Boot versions too often, you should enable caching on your service. Spring Initializr has some auto-configuration to apply the proper caches if you are willing to use a JCache (JSR-107) implementation. diff --git a/initializr-metadata/src/main/java/io/spring/initializr/metadata/InitializrConfiguration.java b/initializr-metadata/src/main/java/io/spring/initializr/metadata/InitializrConfiguration.java index ce02db6c..293d7b63 100644 --- a/initializr-metadata/src/main/java/io/spring/initializr/metadata/InitializrConfiguration.java +++ b/initializr-metadata/src/main/java/io/spring/initializr/metadata/InitializrConfiguration.java @@ -179,7 +179,7 @@ public class InitializrConfiguration { /** * The metadata url of the Spring Boot project. */ - private String springBootMetadataUrl = "https://spring.io/api/projects/spring-boot/releases"; + private String springBootMetadataUrl = "https://api.spring.io/projects/spring-boot/releases"; /** * Tracking code for Google Analytics. Only enabled if a value is explicitly diff --git a/initializr-service-sample/README.adoc b/initializr-service-sample/README.adoc index 304a3583..5af2137f 100644 --- a/initializr-service-sample/README.adoc +++ b/initializr-service-sample/README.adoc @@ -51,7 +51,7 @@ When you issue your first request, you should see something like the following: [indent=0] ---- -Fetching Spring Boot metadata from https://spring.io/api/projects/spring-boot/releases +Fetching Spring Boot metadata from https://api.spring.io/projects/spring-boot/releases ---- On further request, you won't see this log entry as the content is cached. diff --git a/initializr-web/src/test/java/io/spring/initializr/web/support/SpringBootMetadataReaderTests.java b/initializr-web/src/test/java/io/spring/initializr/web/support/SpringBootMetadataReaderTests.java index 30c9e357..4d62a967 100755 --- a/initializr-web/src/test/java/io/spring/initializr/web/support/SpringBootMetadataReaderTests.java +++ b/initializr-web/src/test/java/io/spring/initializr/web/support/SpringBootMetadataReaderTests.java @@ -52,7 +52,7 @@ class SpringBootMetadataReaderTests { @Test void readAvailableVersions() throws IOException { - this.server.expect(requestTo("https://spring.io/api/projects/spring-boot/releases")).andRespond( + this.server.expect(requestTo("https://api.spring.io/projects/spring-boot/releases")).andRespond( withSuccess(new ClassPathResource("metadata/springio/spring-boot.json"), MediaType.APPLICATION_JSON)); List versions = new SpringBootMetadataReader(this.objectMapper, this.restTemplate, this.metadata.getConfiguration().getEnv().getSpringBootMetadataUrl()).getBootVersions(); @@ -69,7 +69,7 @@ class SpringBootMetadataReaderTests { @Test void readAvailableVersionsWithInvalidVersion() throws IOException { - this.server.expect(requestTo("https://spring.io/api/projects/spring-boot/releases")) + this.server.expect(requestTo("https://api.spring.io/projects/spring-boot/releases")) .andRespond(withSuccess(new ClassPathResource("metadata/springio/spring-boot-invalid-version.json"), MediaType.APPLICATION_JSON)); List versions = new SpringBootMetadataReader(this.objectMapper, this.restTemplate, diff --git a/initializr-web/src/test/resources/metadata/config/test-default.json b/initializr-web/src/test/resources/metadata/config/test-default.json index 805f16e6..94912920 100644 --- a/initializr-web/src/test/resources/metadata/config/test-default.json +++ b/initializr-web/src/test/resources/metadata/config/test-default.json @@ -137,7 +137,7 @@ "version": "1.0.0.RELEASE" } }, - "springBootMetadataUrl": "https://spring.io/api/projects/spring-boot/releases" + "springBootMetadataUrl": "https://api.spring.io/projects/spring-boot/releases" }}, "dependencies": { "content": [ diff --git a/initializr-web/src/test/resources/metadata/springio/spring-boot-invalid-version.json b/initializr-web/src/test/resources/metadata/springio/spring-boot-invalid-version.json index ce5295f1..aa47d2f2 100644 --- a/initializr-web/src/test/resources/metadata/springio/spring-boot-invalid-version.json +++ b/initializr-web/src/test/resources/metadata/springio/spring-boot-invalid-version.json @@ -9,7 +9,7 @@ "apiDocUrl": "https://docs.spring.io/spring-boot/docs/3.0.2-SNAPSHOT/api/", "_links": { "self": { - "href": "https://spring.io/api/projects/spring-boot/releases/3.0.2-SNAPSHOT" + "href": "https://api.spring.io/projects/spring-boot/releases/3.0.2-SNAPSHOT" }, "repository": { "href": "https://spring.io/api/repositories/spring-snapshots" @@ -24,7 +24,7 @@ "apiDocUrl": "https://docs.spring.io/spring-boot/docs/current/api/", "_links": { "self": { - "href": "https://spring.io/api/projects/spring-boot/releases/3.0.1" + "href": "https://api.spring.io/projects/spring-boot/releases/3.0.1" }, "repository": { "href": "https://spring.io/api/repositories/spring-releases" @@ -35,7 +35,7 @@ }, "_links": { "current": { - "href": "https://spring.io/api/projects/spring-boot/releases/current" + "href": "https://api.spring.io/projects/spring-boot/releases/current" }, "project": { "href": "https://spring.io/api/projects/spring-boot" diff --git a/initializr-web/src/test/resources/metadata/springio/spring-boot-no-default.json b/initializr-web/src/test/resources/metadata/springio/spring-boot-no-default.json index c97f2ba7..8d9bcf60 100644 --- a/initializr-web/src/test/resources/metadata/springio/spring-boot-no-default.json +++ b/initializr-web/src/test/resources/metadata/springio/spring-boot-no-default.json @@ -9,7 +9,7 @@ "apiDocUrl": "https://docs.spring.io/spring-boot/docs/3.0.2-SNAPSHOT/api/", "_links": { "self": { - "href": "https://spring.io/api/projects/spring-boot/releases/3.0.2-SNAPSHOT" + "href": "https://api.spring.io/projects/spring-boot/releases/3.0.2-SNAPSHOT" }, "repository": { "href": "https://spring.io/api/repositories/spring-snapshots" @@ -24,7 +24,7 @@ "apiDocUrl": "https://docs.spring.io/spring-boot/docs/current/api/", "_links": { "self": { - "href": "https://spring.io/api/projects/spring-boot/releases/3.0.1" + "href": "https://api.spring.io/projects/spring-boot/releases/3.0.1" }, "repository": { "href": "https://spring.io/api/repositories/spring-releases" @@ -39,7 +39,7 @@ "apiDocUrl": "https://docs.spring.io/spring-boot/docs/2.7.8-SNAPSHOT/api/", "_links": { "self": { - "href": "https://spring.io/api/projects/spring-boot/releases/2.7.8-SNAPSHOT" + "href": "https://api.spring.io/projects/spring-boot/releases/2.7.8-SNAPSHOT" }, "repository": { "href": "https://spring.io/api/repositories/spring-snapshots" @@ -54,7 +54,7 @@ "apiDocUrl": "https://docs.spring.io/spring-boot/docs/2.7.7/api/", "_links": { "self": { - "href": "https://spring.io/api/projects/spring-boot/releases/2.7.7" + "href": "https://api.spring.io/projects/spring-boot/releases/2.7.7" }, "repository": { "href": "https://spring.io/api/repositories/spring-releases" @@ -69,7 +69,7 @@ "apiDocUrl": "https://docs.spring.io/spring-boot/docs/2.6.14/api/", "_links": { "self": { - "href": "https://spring.io/api/projects/spring-boot/releases/2.6.14" + "href": "https://api.spring.io/projects/spring-boot/releases/2.6.14" }, "repository": { "href": "https://spring.io/api/repositories/spring-releases" @@ -84,7 +84,7 @@ "apiDocUrl": "https://docs.spring.io/spring-boot/docs/2.5.14/api/", "_links": { "self": { - "href": "https://spring.io/api/projects/spring-boot/releases/2.5.14" + "href": "https://api.spring.io/projects/spring-boot/releases/2.5.14" }, "repository": { "href": "https://spring.io/api/repositories/spring-releases" @@ -99,7 +99,7 @@ "apiDocUrl": "https://docs.spring.io/spring-boot/docs/2.4.13/api/", "_links": { "self": { - "href": "https://spring.io/api/projects/spring-boot/releases/2.4.13" + "href": "https://api.spring.io/projects/spring-boot/releases/2.4.13" }, "repository": { "href": "https://spring.io/api/repositories/spring-releases" @@ -110,7 +110,7 @@ }, "_links": { "current": { - "href": "https://spring.io/api/projects/spring-boot/releases/current" + "href": "https://api.spring.io/projects/spring-boot/releases/current" }, "project": { "href": "https://spring.io/api/projects/spring-boot" diff --git a/initializr-web/src/test/resources/metadata/springio/spring-boot.json b/initializr-web/src/test/resources/metadata/springio/spring-boot.json index 07035e68..c14dfba9 100644 --- a/initializr-web/src/test/resources/metadata/springio/spring-boot.json +++ b/initializr-web/src/test/resources/metadata/springio/spring-boot.json @@ -9,7 +9,7 @@ "apiDocUrl": "https://docs.spring.io/spring-boot/docs/3.0.2-SNAPSHOT/api/", "_links": { "self": { - "href": "https://spring.io/api/projects/spring-boot/releases/3.0.2-SNAPSHOT" + "href": "https://api.spring.io/projects/spring-boot/releases/3.0.2-SNAPSHOT" }, "repository": { "href": "https://spring.io/api/repositories/spring-snapshots" @@ -24,7 +24,7 @@ "apiDocUrl": "https://docs.spring.io/spring-boot/docs/current/api/", "_links": { "self": { - "href": "https://spring.io/api/projects/spring-boot/releases/3.0.1" + "href": "https://api.spring.io/projects/spring-boot/releases/3.0.1" }, "repository": { "href": "https://spring.io/api/repositories/spring-releases" @@ -39,7 +39,7 @@ "apiDocUrl": "https://docs.spring.io/spring-boot/docs/2.7.8-SNAPSHOT/api/", "_links": { "self": { - "href": "https://spring.io/api/projects/spring-boot/releases/2.7.8-SNAPSHOT" + "href": "https://api.spring.io/projects/spring-boot/releases/2.7.8-SNAPSHOT" }, "repository": { "href": "https://spring.io/api/repositories/spring-snapshots" @@ -54,7 +54,7 @@ "apiDocUrl": "https://docs.spring.io/spring-boot/docs/2.7.7/api/", "_links": { "self": { - "href": "https://spring.io/api/projects/spring-boot/releases/2.7.7" + "href": "https://api.spring.io/projects/spring-boot/releases/2.7.7" }, "repository": { "href": "https://spring.io/api/repositories/spring-releases" @@ -69,7 +69,7 @@ "apiDocUrl": "https://docs.spring.io/spring-boot/docs/2.6.14/api/", "_links": { "self": { - "href": "https://spring.io/api/projects/spring-boot/releases/2.6.14" + "href": "https://api.spring.io/projects/spring-boot/releases/2.6.14" }, "repository": { "href": "https://spring.io/api/repositories/spring-releases" @@ -84,7 +84,7 @@ "apiDocUrl": "https://docs.spring.io/spring-boot/docs/2.5.14/api/", "_links": { "self": { - "href": "https://spring.io/api/projects/spring-boot/releases/2.5.14" + "href": "https://api.spring.io/projects/spring-boot/releases/2.5.14" }, "repository": { "href": "https://spring.io/api/repositories/spring-releases" @@ -99,7 +99,7 @@ "apiDocUrl": "https://docs.spring.io/spring-boot/docs/2.4.13/api/", "_links": { "self": { - "href": "https://spring.io/api/projects/spring-boot/releases/2.4.13" + "href": "https://api.spring.io/projects/spring-boot/releases/2.4.13" }, "repository": { "href": "https://spring.io/api/repositories/spring-releases" @@ -110,7 +110,7 @@ }, "_links": { "current": { - "href": "https://spring.io/api/projects/spring-boot/releases/current" + "href": "https://api.spring.io/projects/spring-boot/releases/current" }, "project": { "href": "https://spring.io/api/projects/spring-boot"