Should be added here:
https://github.com/spring-projects/spring-boot/blob/3e37a50b1e0835a0eb04ba1755551e1eafbc236d/spring-boot-project/spring-boot-docs/src/docs/antora/modules/ROOT/pages/redirect.adoc#L1409-L1426
Comment From: philwebb
I think ideally we should add all redirects from https://raw.githubusercontent.com/spring-projects/spring-boot/refs/heads/3.1.x/spring-boot-project/spring-boot-docs/src/docs/asciidoc/anchor-rewrite.properties
Comment From: philwebb
Hacked up app to migrate
/*
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.TreeMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Temp {
private static final Pattern XREF = Pattern.compile("\\* xref:(.*)\\[(.*)\\]");
private static final List<String> IGNORE = List.of("boot-features-connecting-to-solr", "boot-features-jta-atomikos",
"boot-features-mongo-embedded", "boot-features-solr", "getting-started-cli-example",
"howto-use-tomcat-legacycookieprocessor", "legal", "production-ready-endpoints-custom-controller",
"production-ready-endpoints-custom-servlet");
public static void main(String[] args) throws Exception {
Map<String, String> redirects = loadRedirects();
Map<String, String> anchors = loadAnchors();
Map<String, String> additions = new LinkedHashMap<>();
anchors.forEach((from, to) -> {
if (redirects.get("#" + to) != null) {
additions.put(redirects.get("#" + to), from);
}
else if (redirects.get("#" + from) != null) {
additions.put(redirects.get("#" + from), to);
}
else if (!IGNORE.contains(from) && !from.contains("whats-next") && !from.startsWith("cli-")
&& !from.contains("jolokia")) {
System.out.println(from + " " + to);
}
});
}
private static Map<String, String> loadRedirects() throws Exception {
Path redirect = Path.of("src/docs/antora/modules/ROOT/pages/redirect.adoc");
List<String> lines = Files.readAllLines(redirect);
Map<String, String> redirects = new HashMap<>();
for (String line : lines) {
Matcher matcher = XREF.matcher(line);
if (matcher.matches()) {
redirects.put(matcher.group(2), matcher.group(1));
}
}
return redirects;
}
private static Map<String, String> loadAnchors() throws IOException, FileNotFoundException {
Properties properties = new Properties();
properties.load(new FileInputStream("src/docs/antora/modules/ROOT/pages/anchors.properties"));
Map<String, String> anchors = new TreeMap<>();
properties.forEach((key, value) -> anchors.put((String) key, (String) value));
return anchors;
}
}