SpringBoot之自定義banner使用代碼實例
自定義banner的使用
1、spring默認(rèn)啟動banner如下:

2、通過自定義顯示圖形,圖形查看連接:
3、創(chuàng)建一個文件名稱為banner.txt, 將查看的圖形拷貝到該文件中。如下:

4、將banner.txt拷貝到項目的/src/main/resources資源文件目錄中。

5、重啟服務(wù)查看如下:

如果不想顯示banner,可以通過啟動設(shè)置關(guān)閉banner。
package com.example.springboot.mybatis;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* @desc mybatis啟動服務(wù)
* @Author wangsh
* @date 2018/5/5 23:20
* @return
*/
@SpringBootApplication
//如果mybatis中service實現(xiàn)類中加入@Transaction事務(wù)注解,需要此處添加該注解
@EnableTransactionManagement
//掃描的是mapper.xml中namespace指向值的包位置
@ComponentScan("com.example.springboot.mybatis")
public class SpringbootMybatisApplication {
public static void main(String[] args) {
// SpringApplication.run(SpringbootMybatisApplication.class, args);
SpringApplication app = new SpringApplication(SpringbootMybatisApplication.class);
//關(guān)閉打印banner
app.setBannerMode(Banner.Mode.OFF);
app.run(args);
}
}關(guān)閉banner后啟動服務(wù)如下:

到此這篇關(guān)于SpringBoot之自定義banner使用代碼實例的文章就介紹到這了,更多相關(guān)自定義banner使用內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
idea 實現(xiàn)縱列選擇和大小寫轉(zhuǎn)換操作
這篇文章主要介紹了idea 實現(xiàn)縱列選擇和大小寫轉(zhuǎn)換操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2021-02-02
SpringBoot項目中使用Jasypt實現(xiàn)配置文件敏感信息加密
這篇文章主要介紹了如何使用Jasypt庫對SpringBoot項目中的敏感信息進行加密和解密,首先,生成加密密文,然后在SpringBoot配置文件中集成Jasypt,實現(xiàn)自動加密和解密,最后,強調(diào)了加密密鑰的安全配置,需要的朋友可以參考下2026-05-05
Java數(shù)據(jù)結(jié)構(gòu)之稀疏矩陣定義與用法示例
這篇文章主要介紹了Java數(shù)據(jù)結(jié)構(gòu)之稀疏矩陣定義與用法,結(jié)合實例形式分析了java稀疏矩陣的定義、運算、轉(zhuǎn)換等相關(guān)操作技巧,需要的朋友可以參考下2018-01-01
SpringBoot項目構(gòu)建Maven標(biāo)簽及屬性用法詳解
在?Spring?Boot?項目中,Maven?是最常用的構(gòu)建工具之一,本文將詳細介紹?Maven?依賴管理中的主要標(biāo)簽及其使用方法,幫助開發(fā)者更好地理解和使用?Maven?構(gòu)建工具,感興趣的朋友跟隨小編一起看看吧2024-08-08
java格式化數(shù)字操作 NumberFormat及DecimalFormat
這篇文章主要介紹了java格式化數(shù)字操作 NumberFormat及DecimalFormat,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2021-10-10

