zoukankan      html  css  js  c++  java
  • SpringBoot banner输出的方式

    banner输出的方式

    1、默认banner输出

    就是spring boot

    2、文字banner。修改banner图

    在resources下创建banner.txt 。内容为

    /*
                       _ooOoo_
                      o8888888o
                      88" . "88
                      (| -_- |)
                      O  =  /O
                   ____/`---'\____
                 .'  \|     |//  `.
                /  \|||  :  |||//  
               /  _||||| -:- |||||-  
               |   | \  -  /// |   |
               | \_|  ''---/''  |   |
                 .-\__  `-`  ___/-. /
             ___`. .'  /--.--  `. . __
          ."" '<  `.___\_<|>_/___.'  >'"".
         | | :  `- \`.;` _ /`;.`/ - ` : | |
            `-.   \_ __ /__ _/   .-` /  /
    ======`-.____`-.___\_____/___.-`____.-'======
                       `=---='
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
             佛祖保佑       永无BUG
    */
    

      

    然后运行SpringBoot项目

    可以看到打印已经变了

    将banner.txt 修改为favorite.txt , 这样就没有效果了,需要在

    application.properties 配置spring.banner.location=favorite.txt才有效果。

    3、图片banner。 使用图片做banner

    在resources下创建banner.jpg

    启动项目后打印效果如下:

     如果将banner.jpg改成favorite.jpg执行在application.properties 中设置spring.banner.image.location=favorite.jpg

    4、兜底banner。使用代码配置banner

    public class Sb2Application {
    
    	public static void main(String[] args) {
    		SpringApplication springApplication = new SpringApplication(Sb2Application.class);
    		springApplication.setBanner(new ResourceBanner(new ClassPathResource("favorite.txt")));
    		springApplication.addListeners(new SecondListener());
    		springApplication.run(args);
    	}
    
    }
    

      

    5、关闭banner的打印。在application.properties配置如下

    spring.main.banner-mode=off
    

      

  • 相关阅读:
    设置导航栏标题颜色及字体大小
    FMDB的简单实用
    iPhone越狱
    P1122 最大子树和
    UVA11090 Going in Cycle!!
    P1156 垃圾陷阱
    P1325 雷达安装
    P1038 神经网络
    P2922 [USACO08DEC]秘密消息Secret Message
    P2292 [HNOI2004]L语言
  • 原文地址:https://www.cnblogs.com/linlf03/p/12369131.html
Copyright © 2011-2022 走看看