Spring Boot - Custom banner example - Walking Techie

Blog about Java programming, Design Pattern, and Data Structure.

Sunday, June 24, 2018

Spring Boot - Custom banner example

This post will show you how to replace the default spring boot banner with your custom banner.

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.3.RELEASE)

Solution

To add a custom banner in spring boot, create a banner.txt file and put it under resources folder.

You can generate the ASCII based custom banner from here

 __    __  ___  __    __ __ __ __  __   ___     ______  ____   ___ __  __ __  ____
 ||    || // \\ ||    || // || ||\ ||  // \\    | || | ||     //   ||  || || ||
 \\ /\ // ||=|| ||    ||<<  || ||\\|| (( ___      ||   ||==  ((    ||==|| || ||==
  \V/\V/  || || ||__| || \\ || || \||  \\_||      ||   ||___  \\__ ||  || || ||___

Now start the spring boot application. Spring boot default banner will replace with your custom banner. Output will look like below.

 __    __  ___  __    __ __ __ __  __   ___     ______  ____   ___ __  __ __  ____
 ||    || // \\ ||    || // || ||\ ||  // \\    | || | ||     //   ||  || || ||
 \\ /\ // ||=|| ||    ||<<  || ||\\|| (( ___      ||   ||==  ((    ||==|| || ||==
  \V/\V/  || || ||__| || \\ || || \||  \\_||      ||   ||___  \\__ ||  || || ||___
2018-06-24 07:53:25.954  INFO 10468 --- [  restartedMain] c.walking.techie.HelloWorldApplication   : Starting HelloWorldApplication on administrator-ThinkPad-L450 with PID 10468 (/home/santosh/Documents/Documents/spring-boot/spring-boot-hello-world/target/classes started by santosh in /home/santosh/Documents/Documents/spring-boot/spring-boot-hello-world)
2018-06-24 07:53:25.958  INFO 10468 --- [  restartedMain] c.walking.techie.HelloWorldApplication   : No active profile set, falling back to default profiles: default
2018-06-24 07:53:26.103  INFO 10468 --- [  restartedMain] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@5e4dc06b: startup date [Sun Jun 24 07:53:26 IST 2018]; root of context hierarchy
2018-06-24 07:53:27.485  INFO 10468 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8086 (http)

No comments :

Post a Comment