• springboot定制banner


    一、生成艺术字

    springboot启动时会打印一个banner,就是spring的艺术字,

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

    这个是可以自定义的。

    (1)、若设置艺术字,可以到下面的网站去生成艺术字,然后复制到txt文件中即可。网址:

    http://www.network-science.de/ascii/
    http://www.kammerl.de/ascii/AsciiSignature.php
    http://www.patorjk.com/software/taag
    https://www.bootschool.net/ascii

    如访问http://www.network-science.de/ascii/,字体选择standard

    如访问:http://www.kammerl.de/ascii/AsciiSignature.php,字体选择standard,

    如访问:http://www.patorjk.com/software/taag,选择standard

    如访问:https://www.bootschool.net/ascii,选择standard

    还可以下载banner.txt文件,

     二、springboot项目中使用艺术字

    在资源目录下创建一个banner.txt,在里面写入的文本就会在项目启动的时候打印出来。

     ____             _
    / ___| _ __  _ __(_)_ __   __ _
    \___ \| '_ \| '__| | '_ \ / _` |
     ___) | |_) | |  | | | | | (_| |
    |____/| .__/|_|  |_|_| |_|\__, |
          |_|                 |___/
    :: Spring Boot :: (${spring-boot.version})

    启动后效果如下:

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

    若要显示SpringBoot的版本信息,则可以在里面添加下面的代码

    ${spring-boot.version}
    ${spring-boot.formatted-version}

    使用下面一种就会在版本前面多一个v,如

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

    三、关闭banner

    不过这个banner也是可以设置关闭的,修改mian方法:

    @SpringBootApplication
    @MapperScan("com.zwh.dao")
    public class MySpringBootApplication {
        public static void main(String[] args) {
            SpringApplicationBuilder builder=new SpringApplicationBuilder(MySpringBootApplication.class);
            builder.bannerMode(Banner.Mode.OFF).run(args);
    //        SpringApplication.run(MySpringBootApplication.class);
        }
    }
  • 相关阅读:
    jQuery基础及选择器
    JavaScript面向对象
    JavaScript操作DOM
    JavaScript Bom对象
    jquery内容
    jQuery基础
    正则表达式
    表单校验
    使用jQuery操作DOM
    jQuery中的动画
  • 原文地址:https://www.cnblogs.com/zwh0910/p/16648714.html
Copyright © 2020-2023  润新知