在2016年的最後一天,借用Spring Boot的Banner向各位程序猿同仁們問候一聲:Happy New Year。php

接下來咱們就來介紹一下這個輕鬆愉快的自定義banner功能。實現的方式很是簡單,咱們只須要在Spring Boot工程的/src/main/resources
目錄下建立一個banner.txt
文件,而後將ASCII字符畫複製進去,就能替換默認的banner了。好比上圖中的輸出,就採用了下面的banner.txt
內容:html
- ${AnsiColor.BRIGHT_GREEN}
- ## ## ### ######## ######## ## ## ## ## ######## ## ## ## ## ######## ### ########
- ## ## ## ## ## ## ## ## ## ## ### ## ## ## ## ## ## ## ## ## ## ## ##
- ## ## ## ## ## ## ## ## #### #### ## ## ## ## ## #### ## ## ## ## ##
- ######### ## ## ######## ######## ## ## ## ## ###### ## ## ## ## ###### ## ## ########
- ## ## ######### ## ## ## ## #### ## ## ## ## ## ## ######### ## ##
- ## ## ## ## ## ## ## ## ### ## ## ## ## ## ## ## ## ## ##
- ## ## ## ## ## ## ## ## ## ######## ### ### ## ######## ## ## ## ##
- ${AnsiColor.BRIGHT_RED}
- Application Version: ${application.version}${application.formatted-version}
- Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
從上面的內容中能夠看到,還使用了一些屬性設置:spring
${AnsiColor.BRIGHT_RED}
:設置控制檯中輸出內容的顏色
${application.version}
:用來獲取MANIFEST.MF
文件中的版本號
${application.formatted-version}
:格式化後的${application.version}
版本信息
${spring-boot.version}
:Spring Boot的版本號
${spring-boot.formatted-version}
:格式化後的${spring-boot.version}
版本信息
生成工具
若是讓咱們手工的來編輯這些字符畫,顯然是一件很是困難的差事。因此,咱們能夠藉助下面這些工具,輕鬆地根據文字或圖片來生成用於Banner輸出的字符畫。app
我比較喜歡這兩個字體spring-boot
Font Name: Small Slant
Font Name: Slant工具
年終彩蛋
最後,奉上程序猿必備Banner 「永不宕機佛祖」,祝你們:「新年快樂、永不宕機、永無Bug」!字體
- ${AnsiColor.BRIGHT_YELLOW}
- ////////////////////////////////////////////////////////////////////
- // _ooOoo_ //
- // o8888888o //
- // 88" . "88 //
- // (| ^_^ |) //
- // O\ = /O //
- // ____/`---'\____ //
- // .' \\| |// `. //
- // / \\||| : |||// \ //
- // / _||||| -:- |||||- \ //
- // | | \\\ - /// | | //
- // | \_| ''\---/'' | | //
- // \ .-\__ `-` ___/-. / //
- // ___`. .' /--.--\ `. . ___ //
- // ."" '< `.___\_<|>_/___.' >'"". //
- // | | : `- \`.;`\ _ /`;.`/ - ` : | | //
- // \ \ `-. \_ __\ /__ _/ .-` / / //
- // ========`-.____`-.___\_____/___.-`____.-'======== //
- // `=---=' //
- // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
- // 佛祖保佑 永不宕機 永無BUG //
- ////////////////////////////////////////////////////////////////////
效果圖:spa
