SpringBoot of Personalized Banner

SpringBoot fancy boot image
  • We note springboot when the project started, the console will print that comes with banner, then we show for some years, it was too monotonous too ordinary too general; therefore, is the real time performance of the technology
  • SpringBoot has an interface org.springframework.boot.Banner is designed to do this operation. We can implement this interface to customize the print Banner information; but not necessary. We only need to use this show operating just fine.
  • Man of few words said, the first picture shows King
    Here Insert Picture Description
So, how do we achieve it?
  • Only need resources file springboot project folder below to create a banner.txt file, springboot time will start to load this file
  • banner.txt
Spring Boot Version: ${spring-boot.version}
////////////////////////////////////////////////////////////////////
//                          _ooOoo_                               //
//                         o8888888o                              //
//                         88" . "88                              //
//                         (| ^_^ |)                              //
//                         O\  =  /O                              //
//                      ____/`---'\____                           //
//                    .'  \\|     |//  `.                         //
//                   /  \\|||  :  |||//  \                        //
//                  /  _||||| -:- |||||-  \                       //
//                  |   | \\\  -  /// |   |                       //
//                  | \_|  ''\---/''  |   |                       //
//                  \  .-\__  `-`  ___/-. /                       //
//                ___`. .'  /--.--\  `. . ___                     //
//              ."" '<  `.___\_<|>_/___.'  >'"".                  //
//            | | :  `- \`.;`\ _ /`;.`/ - ` : | |                 //
//            \  \ `-.   \_ __\ /__ _/   .-` /  /                 //
//      ========`-.____`-.___\_____/___.-`____.-'========         //
//                           `=---='                              //
//      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        //
//            佛祖保佑       永不宕机     永无BUG                 //
////////////////////////////////////////////////////////////////////
banner.txt Configuration
  • $ {AnsiColor.BRIGHT_RED}: setting console output color contents
  • $ {Application.version}: used to obtain the version number of the MANIFEST.MF file
  • $ {Application.formatted-version}: formatted version information $ {application.version}
  • $ {Spring-boot.version}: Spring Boot version number
  • $ {Spring-boot.formatted-version}: formatted $ {spring-boot.version} version information
Close banner
  • banner enabled by default, if you do not want it to print how to do?
    • 1, is provided in the main run method
    /**
     * 启动主类,springboot的入口
     * springboot 默认扫描的类是在启动类的当前包和下级包
     */
    @SpringBootApplication
    public class SpringbootApp {
    
        public static void main(String[] args) {
            SpringApplication springApplication = new SpringApplication(SpringbootApp.class);
            //Banner.Mode.OFF 关闭
            springApplication.setBannerMode(Banner.Mode.OFF);
            springApplication.run(args);
        }
    }
    
    • Method 2, Edit Configurations -> Check Hide banner
      Here Insert Picture Description
banner.txt
  • Here are a few sites customized banner, text, pictures can show up, show how to see your show the operation
    • http://patorjk.com/software/taag
    • http://www.network-science.de/ascii/
    • http://www.degraeve.com/img2txt.php

The more you know, the more you do not know.
Proper way without surgery, patients can still seek, there is no way to surgery, ending surgery.
If you have other questions, welcome message, we can discuss, learn together and progress together

He published 193 original articles · won praise 116 · views 10000 +

Guess you like

Origin blog.csdn.net/qq_40722827/article/details/104983459