Playing With Spring Boot Banner

Posted By : Gaurav Kumar | 22-Jan-2021

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 the spring boot banner.

Have you noticed whenever 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 screenshot below?

 

 

Now, here is the stuff you can perform with this logo.

 

 

  • You can remove the entire logo,
  • You can customize the text of the logo
  • You can customize the font, color, and style of the logo.
  • You can use any image instead of text.

 

Also Read: Spring Boot Data Rest

 

Let's see all of the above one by one.

You can remove or turn off the default spring logo populating while running the spring boot application by either using the properties file or programmatically.
 

Removing the Entire Logo

 

using the application.properties file

   spring.main.banner-mode="off"  
 

using application.yml file 

 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 in the following way:
 
using banner.txt file
 
This is the default name of the 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 the resource folder with banner.txt name, spring will auto detects this file and loads its content while startup.
 
A sample startup screenshot is added below.
 
 
 
 
It is pretty much difficult to design a text-based logo. You can try this website to get the 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 the properties file like.
 
 spring.banner.location=classpath:realtive-path/banner.txt  
 
You can also provide any png/gif/jpg image there with a name banner, Spring Boot converts the image file to ASCII art representation automatically and prints it above the text banner, but this will leads your service a little bit slow. So I would strongly recommend you to use text-based design or formatting.
 
So that's all stuff you can perform with your spring boot default banner.
 
That all for this quick blog. Hope you found these quick experiments interesting and fascinating. Thanks.
 

Also Read: Profiles in Spring Boot

 

Why You Should Choose Oodles For SaaS Product Development?

 

We are a 360-degree software development company that provides cross-platform SaaS app development services to address varied software project requirements. We have an experienced team of Java, PHP, and Python developers who use advanced frameworks, tools, and SDKs to build scalable web and mobile applications with custom features. For more detail, reach us out at [email protected]

 

About Author

Author Image
Gaurav Kumar

He is always ready to grasp new tech and tools as per project requirement.

Request for Proposal

Name is required

Comment is required

Sending message..