Spring Boot Custom Banner example
By:Roy.LiuLast updated:2019-08-11
This article shows you how to replace the default Spring’s banner below with your custom banner.
. ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.5.1.RELEASE)
Solution
1. To add a custom banner in Spring Boot application, create a banner.txt file and put it into the resources folder.
2. Review the content of banner.txt, this ASCII Art is created by this “ASCII Art Java example“, and the ANSI colors are added manually.
src/main/resources/banner.txt
${Ansi.RED} $$$ $$$$$ $$$$ $$$$ $$$$$ ${Ansi.GREEN} $$$ $$$$$$$ $$$$ $$$$ $$$$$$$ ${Ansi.BLUE} $$$ $$$$$$$ $$$$$ $$$$$ $$$$$$$ ${Ansi.RED} $$$ $$$$$$$ $$$$ $$$$ $$$$$$$ ${Ansi.GREEN} $$$ $$$$ $$$$ $$$$$ $$$$$ $$$$ $$$$ ${Ansi.BLUE} $$$ $$$$ $$$$ $$$$ $$$$ $$$$ $$$$ ${Ansi.RED} $$$ $$$$$ $$$$$ $$$$ $$$$ $$$$$ $$$$$ ${Ansi.GREEN} $$$ $$$$ $$$$ $$$$$ $$$$$ $$$$ $$$$ ${Ansi.BLUE} $$$ $$$$ $$$$ $$$$ $$$$ $$$$ $$$$ ${Ansi.RED} $$$ $$$$$ $$$$$ $$$$$ $$$$$ $$$$$ $$$$$ ${Ansi.GREEN} $$$ $$$$$$$$$$$$$ $$$$ $$$$ $$$$$$$$$$$$$ ${Ansi.BLUE} $$$$ $$$$ $$$$$$$$$$$$$ $$$$ $$$$ $$$$$$$$$$$$$ ${Ansi.RED} $$$$ $$$$ $$$$$$$$$$$$$$$ $$$$$$$ $$$$$$$$$$$$$$$ ${Ansi.GREEN} $$$$$ $$$$$ $$$$ $$$$ $$$$$$$ $$$$ $$$$ ${Ansi.BLUE} $$$$$$$$$$$ $$$$$ $$$$$ $$$$$$$ $$$$$ $$$$$ ${Ansi.RED} $$$$$$$$$ $$$$ $$$$ $$$$$ $$$$ $$$$ ${Ansi.GREEN} $$$$$$$ $$$$ $$$$ $$$$$ $$$$ $$$$ ${Ansi.RED} :: Spring Boot${spring-boot.formatted-version} :: ${Ansi.DEFAULT}
3. Start Spring Boot, the following output will be displayed :
References
From:一号门
COMMENTS