EDUCBA Logo

EDUCBA

MENUMENU
  • Explore
    • EDUCBA Pro
    • PRO Bundles
    • Featured Skills
    • New & Trending
    • Fresh Entries
    • Finance
    • Data Science
    • Programming and Dev
    • Excel
    • Marketing
    • HR
    • PDP
    • VFX and Design
    • Project Management
    • Exam Prep
    • All Courses
  • Blog
  • Enterprise
  • Free Courses
  • Log in
  • Sign Up
Home Software Development Software Development Tutorials Spring Tutorial Spring Boot Banner
 

Spring Boot Banner

Updated April 7, 2023

Spring Boot Banner

 

 

Definition of Spring Boot Banner

In Spring boot framework, we have the provision to show our text in the form of a banner when the application starts up. It is the text which shows up when we start our spring boot application, by the use it we can also create the custom banner according to us, but for that, we have to make little changes to our existing application, also if we do not want that banner so we have one option and property in spring boot application to disable it by using the application properties file. It will always get loads when the application starts running, also in the coming section we will see how it looks like, the default text for this banner is ‘spring’ if you try to run your application then at the beginning only you will see one text ‘spring’ get loaded after that the logs starts priming on the screen. In the coming section of the tutorial, we will see how we can implement this to have our own custom banner at the start of the application for better understanding.

Watch our Demo Courses and Videos

Valuation, Hadoop, Excel, Mobile Apps, Web Development & many more.

Syntax:

As we already know that it is just a banner which shows the text we want at the start of the spring application, let’s take a closer look at what we can do to make it work or not in the existing application see below for a better understanding;

To create:

spring.banner.location=classpath:/path/to/your/ banner/file

As you can see in the above syntax that we need to set this property into the application.property file to create the custom banner in the spring application. Let’s taken a closer look at the practice syntax which will give us better idea see below;

e.g. :

spring.banner.location=classpath:/path/my/banner/logo.txt

It should be a class path, in the coming section of the tutorial we will see the full implementation of this banner with the .txt file and where we can keep this file in order to create the banner in the spring boot application.

How Spring boot banner works?

As we already know a banner is a txt file that get loaded when we start our spring boot application and wherever it contains inside it, will get printed on the screen at the start only. banner in spring boot we can say act as the logo here, if you see the default banner of spring boot you will see the ‘Spring’ written as the start. We have so many options in spring-like, either we can disable this logo, or we can relate a custom banner for our application. In the section of the tutorial we will see how we can do all these things but before we will see some basic things for it let’s get started to see below;

1) banner : It is a logo we can say print by the spring framework, which will get print at the start of the application. Spring uses banner.txt file to show this banner, the default name for this file is banner.txt. If we want to create our own custom file with a different name, then we have to follow the below rule which is as follows:

  1. a) for text to show the file name should end with .txt.
  2. b) For custom file to show we can add the location of the file into the application property file by using the below syntax

spring. banner.location=classpath:/path: by the use of this we can specify own .txt file with the different name used by the spring, by default it takes banner.txt, but by adding this property it will see and look for this file in the classpath, it should be present in the class path.

2) Default banner: if we talk about the default banner available in the spring boot framework then it ‘Spring’, spring boot taken and loaded this from the banner.txt file, let’s take a closer look at the banner how it looks like in default seating for reference attaching one screenshot for this;

Output:

Spring Boot Banner 1

3) Disable : Suppose you do not want any banner to get loaded on the start of the spring boot application then for this also, we can make small changes to the existing application and after that we can try to run our application, steps are mentioned below;

  1. a) to disable the banner from the spring boot application we have to make an entry inside the application property file.
  2. b) For this we have to set the banner mode as off in the application file, for reference please follow the below code to make it work;

e.g. :

spring.main.banner-mode= OFF

This property should be set as ‘OFF’ to disable it. Below find the reference attached after making this property as diablo ;

Output:

Spring Boot Banner 2

4) Image: We can also add an image as the banner in the spring boot application, but for that, we have to change the file type here. For the image type banner, we have to make banner.png or baner.gif as the file extension. Also after making file we have to follow the below steps to configure it properly;

  1. a) First we need to create the .gif or .png file place that file in class-path
  2. b) Second we have to mention the file path inside the application property file like below;

e.g. :

spring.banner.image.location=classpath:custom.banner.png

As you notice in the above property we have used ‘image’ property to set the image, but before we have just directly used the banner to set the location of the custom banner file. this thing we have to keep in mind while creating any custom banner in the spring boot application.

Examples

  • Custom banner example,
  • Place the banner inside the resource folder, reference see the screenshot attached;

e.g. :

Spring Boot Banner 3

  • Make below changes to application.properties fil;

Spring Boot Banner 4

  • Run application you will see the below output:

Output:

image

Conclusion

By the use of it either we can disable the banner or we can add our own banner file to the spring application, this file can be of any type like .txt or .png for the image. This is very easy to crate and handle by the developers so if we want to easily implement it in our application without doing heavy configuration.

Recommended Articles

This is a guide to Spring Boot Banner. Here we discuss definition, syntax, How Spring boot banner works, examples with code implementation. You may also have a look at the following articles to learn more –

  1. Spring Boot Path Variable
  2. Spring Boot Dependencies
  3. Spring Boot Repository
  4. Spring Boot DevTools

Primary Sidebar

Footer

Follow us!
  • EDUCBA FacebookEDUCBA TwitterEDUCBA LinkedINEDUCBA Instagram
  • EDUCBA YoutubeEDUCBA CourseraEDUCBA Udemy
APPS
EDUCBA Android AppEDUCBA iOS App
Blog
  • Blog
  • Free Tutorials
  • About us
  • Contact us
  • Log in
Courses
  • Enterprise Solutions
  • Free Courses
  • Explore Programs
  • All Courses
  • All in One Bundles
  • Sign up
Email
  • [email protected]

ISO 10004:2018 & ISO 9001:2015 Certified

© 2025 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA Login

Forgot Password?

🚀 Limited Time Offer! - 🎁 ENROLL NOW