随笔 - 754  文章 - 0 评论 - 33 阅读 - 135万
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

一、生成艺术字

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);
    }
}
复制代码

 



感谢您的阅读,如果您觉得阅读本文对您有帮助,请点一下“推荐”按钮。本文欢迎各位转载,但是转载文章之后必须在文章页面中给出作者和原文连接
posted on   周文豪  阅读(227)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
历史上的今天:
2021-09-02 RequestBodyAdvice和ResponseBodyAdvice详解,@ControllerAdvice注解
点击右上角即可分享
微信分享提示