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

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

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

5、重啟服務查看如下:

如果不想顯示banner,可以通過啟動設置關閉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啟動服務
* @Author wangsh
* @date 2018/5/5 23:20
* @return
*/
@SpringBootApplication
//如果mybatis中service實現(xiàn)類中加入@Transaction事務注解,需要此處添加該注解
@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);
//關閉打印banner
app.setBannerMode(Banner.Mode.OFF);
app.run(args);
}
}關閉banner后啟動服務如下:

到此這篇關于SpringBoot之自定義banner使用代碼實例的文章就介紹到這了,更多相關自定義banner使用內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
SpringBoot項目中使用Jasypt實現(xiàn)配置文件敏感信息加密
這篇文章主要介紹了如何使用Jasypt庫對SpringBoot項目中的敏感信息進行加密和解密,首先,生成加密密文,然后在SpringBoot配置文件中集成Jasypt,實現(xiàn)自動加密和解密,最后,強調(diào)了加密密鑰的安全配置,需要的朋友可以參考下2026-05-05
java格式化數(shù)字操作 NumberFormat及DecimalFormat
這篇文章主要介紹了java格式化數(shù)字操作 NumberFormat及DecimalFormat,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2021-10-10

