我们都知道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确实改变了打印结果。那么设置一下路径,再看看
这个也生效了了,并且可以看到配置文件的优先级,高于默认的图片优先级,到此结束
springboot修改启动banner
最新推荐文章于 2024-08-26 11:17:25 发布