springboot修改启动banner

我们都知道springboot启动,默认情况下是打印spring字样,如图所示:
在这里插入图片描述
当然,springboot提供了修改方法,让我们可以自己定义想要的打印形式,先看官网:
The banner that is printed on start up can be changed by adding a banner.txt file to your classpath or by setting the spring.banner.location property to the location of such a file. If the file has an encoding other than UTF-8, you can set spring.banner.charset. In addition to a text file, you can also add a banner.gif, banner.jpg, or banner.png image file to your classpath or set the spring.banner.image.location property. Images are converted into an ASCII art representation and printed above any text banner.
我们可以指定banner.txt文件,到我们的路径当中去,那么我试试看
在这里插入图片描述
添加了一个banner.txt文件,内容为:i love java
效果如何呢?
在这里插入图片描述
正如图片显示那样,文字打印
另外,官网还说:可以使用spring.banner.location配置,指定文件,那么是不是文件不一定叫做banner.txt呢,可以试试看
在这里插入图片描述
我修改了文件名称,文件内容,设置文件路径,看效果:
在这里插入图片描述
果然如我们想的那样。
接着往下走: you can also add a banner.gif, banner.jpg, or banner.png image file to your classpath or set the spring.banner.image.location property

设置了banner.png确实改变了打印结果。那么设置一下路径,再看看
在这里插入图片描述
这个也生效了了,并且可以看到配置文件的优先级,高于默认的图片优先级,到此结束

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值