Detailed steps for Spring Boot to start banner customization, springbanner

Source: Internet
Author: User

Detailed steps for Spring Boot to start banner customization, springbanner

Preface

Thanks to everyone, cool programmers who work in unix and linux Command Line environments may also think that command lines are too monotonous, instead, they invented the method of outputting various images using ansii characters in the command line. This is the banner under the command line.


Some cool programmers even developed dynamic banner. For example, in linux (CentOS), execute the following command to install the software sl

sudo yum install sl

After that, enter an sl-a command on the command line to see a small train sprayed with smoke. The screen was opened from right to left, and two people cheered.

When SpringBoot is started, the following information is printed on the command line:


This is the default banner of SpringBoot. The banner can be customized. The specific content is from the official SpringBoot documentation.

SpringBoot text Banner Customization

The first method for customizing spring boot is to edit a banner.txt file, enter the content to be displayed in the banner file, and store the file in the classpath path. Put it in the resource Directory.

In general, to display the effect, we will convert the content to be displayed into the form of ansix. For example, if I want to display HELLO and GRACE in the banner and directly input this text to the file, the display effect is not good. We need to convert it using a text-to-ansix tool.


Copy the following anⅱ characters to the banner.txt file. Start SpringBoot and start banner.


In banner.txt, in addition to directly entering the anⅱ character, you can also configure environment variables. For example, use $ {spring-boot.version} to refer to the SpringBoot version. The new banner.txt content is changed


The started banner is as follows:


For a list of supported variables, see the official SpringBoot documentation.

SpringBoot image Banner Customization

If you think that the text is not cool enough to start banner, you can also set the company logo or product logo image as the start banner. Of course, it is not to display the image in the command line, but to parse the pixel of the image, and then output the image to the command line in the same way as ansix.

The image banner supports gif, png, and jpeg images. When using the image, select the appropriate image, change the image name To banner, and put it in the resource Directory like the banner.txt file of the text.

For example, rename the following jpeg Weibo logo as banner.jpg file to the resource Directory.


Then the banner started by the program will look like below.


If the classpath contains both the banner.txt file and the banner image file, SpringBoot first displays the image banner and then the text banner.

Summary

The above is all the content of this article. I hope the content of this article has some reference and learning value for everyone's learning or work. If you have any questions, please leave a message to us, thank you for your support.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.