cosmo

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
  194 随笔 :: 0 文章 :: 31 评论 :: 197万 阅读

Spring Boot在启动的时候会显示一个默认的Spring的图案,对应的类为SpringBootBanner

图案输出有以下几种模式,默认是CONSOLE的,即只打印到控制台,也可以输出到日志文件

复制代码
enum Mode {
   /**
    * Disable printing of the banner.
    */
   OFF,
   /**
    * Print the banner to System.out.
    */
   CONSOLE,
   /**
    * Print the banner to the log file.
    */
   LOG
}
复制代码

关闭图案

@SpringBootApplication
public class Application {
   public static void main(String[] args) {
       new SpringApplicationBuilder(Application.class).bannerMode(Banner.Mode.OFF)
               .run(args);
   }
}

定制图案:在classpath目录下创建banner.txt即可,把图案放入该文件就行,这是Spring Boot默认的图案位置,Spring Boot会自动加载该文件显示图案

生成图案的网站:http://patorjk.com

也可以通过application配置文件来定制图案

# BANNER
banner.charset=UTF-8 # Banner file encoding.
banner.location=classpath:banner.txt # Banner file location.
banner.image.location=classpath:banner.gif # Banner image file location (jpg/png can also be used).
banner.image.width= # Width of the banner image in chars (default 76)
banner.image.height= # Height of the banner image in chars (default based on image height)
banner.image.margin= # Left hand image margin in chars (default 2)
banner.image.invert= # If images should be inverted for dark terminal themes (default false)

  

posted on   【cosmo】  阅读(1271)  评论(0编辑  收藏  举报
编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
点击右上角即可分享
微信分享提示