How to create and configure custom banner in spring boot
Spring boot application comes with default banner which shows up first when you start your application.
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.3.RELEASE)
You can replace above banner with your self made custom banner in following two easy steps:-
1. Creating text banner
First we need to create a custom banner for the application. Its very difficult to create a spring like banner manually. You can use any of the following tools to create banner:-
For example, I created following banner for my spring boot application
____ _ _ _ ____ _
/ ___|___ __| (_)_ __ __ _ | \ | | / ___|___ _ __ ___ ___ _ __ | |_ ___
| | / _ \ / _` | | '_ \ / _` | | \| | | | / _ \| '_ \ / __/ _ \ '_ \| __/ __|
| |__| (_) | (_| | | | | | (_| | | |\ | | |__| (_) | | | | (_| __/ |_) | |_\__ \
\____\___/ \__,_|_|_| |_|\__, | |_| \_| \____\___/|_| |_|\___\___| .__/ \__|___/
|___/ |_|
2. Configure text banner in Spring boot application
Now we have created text banner, save this in file with name banner.txt under src/main/resources. Spring Boot by default picks up the content from the banner.txt file under resources folder and display it on the startup.
You can also change the location or file name by configuring in application.properties or application.yml file
application.properties
spring.banner.location=classpath:/path/to/custom-banner.txt
application.yml
spring:
banner:
location: classpath:/path/to/custom-banner.txt
That’s it, Restart your application to see your self made banner in console output as below:-