Change Banner declaration with new Java Syntax

See gh-39585
This commit is contained in:
qlido 2024-02-15 20:49:35 +09:00 committed by Moritz Halbritter
parent 224254b300
commit 9c57444464
1 changed files with 10 additions and 9 deletions

View File

@ -30,10 +30,14 @@ import org.springframework.core.env.Environment;
*/
class SpringBootBanner implements Banner {
private static final String[] BANNER = { "", " . ____ _ __ _ _",
" /\\\\ / ___'_ __ _ _(_)_ __ __ _ \\ \\ \\ \\", "( ( )\\___ | '_ | '_| | '_ \\/ _` | \\ \\ \\ \\",
" \\\\/ ___)| |_)| | | | | || (_| | ) ) ) )", " ' |____| .__|_| |_|_| |_\\__, | / / / /",
" =========|_|==============|___/=/_/_/_/" };
private static final String BANNER = """
. ____ _ __ _ _
/\\\\ / ___'_ __ _ _(_)_ __ __ _ \\ \\ \\ \\
( ( )\\___ | '_ | '_| | '_ \\/ _` | \\ \\ \\ \\
\\\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\\__, | / / / /
=========|_|==============|___/=/_/_/_/
""";
private static final String SPRING_BOOT = " :: Spring Boot :: ";
@ -41,11 +45,8 @@ class SpringBootBanner implements Banner {
@Override
public void printBanner(Environment environment, Class<?> sourceClass, PrintStream printStream) {
for (String line : BANNER) {
printStream.println(line);
}
String version = SpringBootVersion.getVersion();
version = (version != null) ? " (v" + version + ")" : "";
printStream.println(BANNER);
String version = String.format(" (v%s)", SpringBootVersion.getVersion());
StringBuilder padding = new StringBuilder();
while (padding.length() < STRAP_LINE_SIZE - (version.length() + SPRING_BOOT.length())) {
padding.append(" ");