Spring Boot控制台打印sao气图案
作者:互联网
目标:更改控制台打印的图案
1、在SpringBoot 项目的resource目录下创建banner.txt文件,在项目初始化时,会去加载资源,banner.txt文件的内容作为一个字符数组传入并打印到控制台。
private Banner printBanner(ConfigurableEnvironment environment) {
if (this.bannerMode == Mode.OFF) {
return null;
} else {
ResourceLoader resourceLoader = this.resourceLoader != null ? this.resourceLoader : new DefaultResourceLoader(this.getClassLoader());
SpringApplicationBannerPrinter bannerPrinter = new SpringApplicationBannerPrinter((ResourceLoader)resourceLoader, this.banner);
return this.bannerMode == Mode.LOG ? bannerPrinter.print(environment, this.mainApplicationClass, logger) : bannerPrinter.print(environment, this.mainApplicationClass, System.out);
}
}
2、简单的文字图案可以到文本转Ascll自定义。
3、我本人使用的是佛祖图案。
${AnsiColor.BRIGHT_YELLOW} _.ooOoo._
${AnsiColor.BRIGHT_RED} o888888888o
${AnsiColor.BRIGHT_CYAN} 88" . "88
${AnsiColor.BRIGHT_MAGENTA} (| ^_^ |)
${AnsiColor.BRIGHT_GREEN} O\ = /O
${AnsiColor.BRIGHT_RED} ____/`-----'\____
${AnsiColor.BRIGHT_CYAN} .' \\| |$$ `.
${AnsiColor.BRIGHT_MAGENTA} / \\||| : |||$$ \
${AnsiColor.BRIGHT_GREEN} / _||||| -:- |||||- \
${AnsiColor.BRIGHT_YELLOW} | | \\\ - $$/ | |
${AnsiColor.BRIGHT_GREEN} | \_| ''\-----/'' | |
${AnsiColor.BRIGHT_YELLOW} \ .-\___ `-` ____/-. /
${AnsiColor.BRIGHT_CYAN} ___`. .' /--.--\ `. . ___
${AnsiColor.BRIGHT_RED} ."" '< `.____\_<|>_/____.' >'"".
${AnsiColor.BRIGHT_GREEN} | | : `- \`.;`.\ _ /``;.`/ - ` : | |
${AnsiColor.BRIGHT_YELLOW} \ \ `-. \_ ___\ /___ _/ .-` / /
${AnsiColor.BRIGHT_CYAN} ========`-.____`-.____\_____/____.-`____.-'========
${AnsiColor.BRIGHT_MAGENTA} `=---='
${AnsiColor.BRIGHT_YELLOW} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
${AnsiColor.BRIGHT_GREEN} 佛祖保佑 永无BUG 永不修改
${AnsiColor.BRIGHT_CYAN}Project Author: 西西小道
${AnsiColor.BRIGHT_YELLOW}Spring Boot: ${spring-boot.formatted-version}
4、效果如下:
Thank you.
标签:sao,Spring,Boot,YELLOW,BRIGHT,AnsiColor,GREEN,CYAN,___ 来源: https://blog.csdn.net/xizhizai/article/details/111125916