Playing With Spring Boot Banner
Hello geeks, here I came up with a quick read but interesting blog post. Here I am going to show you the different possible customization available in spring boot banner.
Have you noticed when ever you set up a brand new spring boot application, and runs it a pretty nice spring log with version information is populated into the console, just like the screen shot below.
Now, here is the stuff you can perform with this logo.
- You can remove the entire logo,
- You can customize the text of logo
- You can customize the font, color and style of logo.
- You can use any image instead of text.
Let's see all of above one by one.
You can remove or turn off the default spring logo populating while running spring boot application by either using properties file or by programmatically.
Removing Entire Logo
using application.properties file
spring.main.banner-mode="off"
spring:
main:
banner-mode: "off"
programmatically
public class Application {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(Application.class);
app.setBannerMode(Banner.Mode.OFF);
app.run(args);
}
}
Customizing Default Logo
The default spring logo can be customized by following way:
using banner.txt file
This is the default name of file for which spring looks under the resource folder for banner customization, you can put your formatted banner into this file and save it under resource folder with banner.txt name, spring will auto detects this file and loads it's content while startup.
A sample startup screen shot is added below.
It is pretty much difficult to design these text based logo. You can try this website to get customized and formatted text.
You can also place this banner.txt file to any other location as well but in that case you need to specify their relative path in properties file like.
spring.banner.location=classpath:realtive-path/banner.txt
So that's all stuff you can perform with you spring boot default banner.
That all for this quick blog. Hope you found this quick experiments interesting and fascinating. Thanks.
Comments
Post a Comment