Get the App
SLTechnology News&Howtos  ›  Development  › 

How to customize Banner for Springboot applications

Shulou Source: shulou.com Published: 2022-06-03 08:46:09 11月15日 Update

How to customize Banner for Springboot application, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.

This small function is said to be a small colored egg of Springboot2.x, which has been out for a long time. I knew I hadn't tried it before, but I tried it this time, and it was okay, it was fun. Recently, because I started to re-read Springboot, I saw this part, so I sorted it into the article.

What is banner?

This is the default Spring logo, sometimes it looks so ugly that it is useless to change it, and sometimes it will slow down the startup of your Springboot application. So just watch and have fun.

One-step realization

Look, in the resource directory of your springboot project, create a new banner.txt file, and what you write in it is what you want to display.

For example, we wrote: "Yu Gong wants to move mountains."

It's ugly to write this way. It's not as good as the previous format, but it doesn't matter, there are some good-looking websites that have been realized for us. Just replace the content after conversion.

You can generate character drawings based on the characters you enter: http://patorjk.com/software/taag/#p=display&f=Doh&t=fengdongdong

You can display the characters according to the drawing: https://www.degraeve.com/img2txt.php

Try using a map.

The effect is as follows:

Figure it out for yourself.

Or ugly? It's okay. Keep looking.

The color is terrible. It's all right. There's still configuration.

Spring provides three enumeration classes to set the color of characters, which are:

AnsiColor: used to set the foreground color of characters

AnsiBackground: used to set the background color of characters

AnsiStyle: used to control bold, italic, underline, and so on.

Let's try to set a color.

Finally, start it and see the effect.

This is the answer to the question about how to customize Banner for Springboot applications. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

Tags: Character ugly content application question color good-looking that is effect more sometimes help solution fun easy nothing it doesn't matter easy three underline Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia MySQL vpn OPPO Reno Shulou Information