Skip to content

Commit d1ceed2

Browse files
committed
Polish banner
1 parent 92ff433 commit d1ceed2

File tree

1 file changed

+15
-4
lines changed
  • spring-boot/src/main/java/org/springframework/boot

1 file changed

+15
-4
lines changed

spring-boot/src/main/java/org/springframework/boot/Banner.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@
2424
import static org.springframework.boot.ansi.AnsiElement.FAINT;
2525
import static org.springframework.boot.ansi.AnsiElement.GREEN;
2626

27-
2827
/**
2928
* Writes the 'Spring' banner.
30-
*
29+
*
3130
* @author Phillip Webb
3231
*/
3332
abstract class Banner {
@@ -40,6 +39,10 @@ abstract class Banner {
4039
" ' |____| .__|_| |_|_| |_\\__, | / / / /",
4140
" =========|_|==============|___/=/_/_/_/" };
4241

42+
private static final String SPRING_BOOT = " :: Spring Boot :: ";
43+
44+
private static final int STRAP_LINE_SIZE = 42;
45+
4346
/**
4447
* Write the banner to the specified print stream.
4548
* @param printStream the output print stream
@@ -49,8 +52,16 @@ public static void write(PrintStream printStream) {
4952
printStream.println(line);
5053
}
5154
String version = Banner.class.getPackage().getImplementationVersion();
52-
printStream.println(AnsiOutput.toString(GREEN, " Spring Boot", DEFAULT,
53-
FAINT, (version == null ? "" : " (v" + version + ")")));
55+
version = (version == null ? "" : " (v" + version + ")");
56+
version = " v0.5.0.BUILD.SNAPSHOT";
57+
String padding = "";
58+
while (padding.length() < STRAP_LINE_SIZE
59+
- (version.length() + SPRING_BOOT.length())) {
60+
padding += " ";
61+
}
62+
63+
printStream.println(AnsiOutput.toString(GREEN, SPRING_BOOT, DEFAULT, padding,
64+
FAINT, version));
5465
printStream.println();
5566
}
5667
}

0 commit comments

Comments
 (0)