Spring Boot note Custom boot banner

Source: Internet
Author: User

Control Banner Content

Spring boot when the default banner is the word spring, look more and feel very monotonous, Spring boot for us to provide a custom banner function.

Custom banner only need to create a new Banner.txt file under Resource, put the banner words we need into, and read the banner in this text file when it is started.

Like what:

                   _ooooo_                  o8888888o                  88 ". "                  (| -_- |)                  O\  =/  o               ____/'---' \____             . '  \\|     | //  `.            /  \\|||  :  ||| //             /  _||||| -:- ||||| -             |   | \\\  -///| |           | \_|  " \---/'  |   |           \  .-\__  '-'  ___/-./         ___ ' ... '  /--.--\  `. . __      ."" ' < '  . ___\_<|>_/___. '  > ' "".     | | :  `- \`.; `\ _ /`;. `/ - ` : | |     \  \ `-.   \_ __\/__ _/   .-'/  /====== '-.____ '-.___\_____/___.-' ____.-' ====== '                   =---= ' ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^, ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^         Buddha bless       never bug

Control Banner Style

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

Ansicolor: Used to set the foreground color of a character

Ansibackground: Used to set the background color of a character

Ansistyle: Used to control bold, italic, underline and so on.

Use ${ansifoo.bar} to specify the style, which is prompted when the style is specified:

Specify a test, such as the following:

${ansicolor.bright_yellow}                   _ooooo_                  o8888888o                  88 ". "                  (| -_- |)                  O\  =/  o               ____/'---' \____             . '  \\|     | //  `.            /  \\|||  :  ||| //             /  _||||| -:- ||||| -             |   | \\\  -///| |           | \_|  " \---/'  |   |           \  .-\__  '-'  ___/-./         ___ ' ... '  /--.--\  `. . __      ."" ' < '  . ___\_<|>_/___. '  > ' "".     | | :  `- \`.; `\ _ /`;. `/ - ` : | |     \  \ `-.   \_ __\/__ _/   .-'/  /====== '-.____ '-.___\_____/___.-' ____.-' ====== '                   =---= ' ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^, ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^         Buddha bless       never bug

Effect:


Well, the reason behind the scenery is so ugly .... But that's not the point.

The

Focus is that the setting of this color can be changed, that is, the same screen can specify more than one ${ansicolor.foocolor} this, after specifying the color until the next specified character is Foocolor color, a simple example, To set the Big Buddha's pimple to a different color (for Shmau I feel the following character is very funny, windy ... ):

${ansicolor.bright_yellow} ${ansicolor.bright_red}_ooooo_${ansicolor.bright_yellow} ${A Nsicolor.bright_red}o8888888o${ansicolor.bright_yellow} ${ansicolor.bright_red}88${ansicolor.bright_yello W} ". "${ansicolor.bright_red}88${ansicolor.bright_yellow} (|                  -_- |)  o\ =/o ____/'---' \____. '     \\|            |//  `.  /  \\||| :  ||| //             /  _||||| -:- |||||   -             | |   \\\  -  /// |           | |  \_|   ' \---/' |           | \  .-\__  `-`  ___/-. /         ___`.  .‘ /--.--\  `. . __      .""  ' < '. ___\_<|>_/___. '     > ' "". | | :  `- \`.; `\ _ /`;.     `/ - ` : | |   \  \ `-. \_ __\/__ _/.-'//====== '-.____ '-.___\_____/___.-' ____.-' ====== ' =---= ' ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^ Buddha blessed with no bugs

Effect:

Show app Information

In addition to the above specified styles, you can also display some version information related to your app:

${application.version} The same version number as the MANIFEST.MF file, such as 1.5.4.RELEASE

${application.formatted-version} formatted version number is the addition of a V and then wrapped up in parentheses, for example (V1.5.4.release)

${application.title}

${spring-boot.version} Spring Boot version

${spring-boot.formatted-version} formatted version

Controls whether the banner is turned on and outputs the position

Set banner mode to OFF banner:

Package Org.cc11001100;import Org.springframework.boot.banner;import org.springframework.boot.SpringApplication; Import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplicationpublic class springbootstudy002application {public static void main (string[] args) {springapplication springapplication = new Springapplication (Springbootstudy002application.class); Springapplication.setbannermode (Banner.Mode.OFF); Springapplication.run (args);}}

Several commonly used character painting to build websites

Introduce several commonly used character painting build sites:

1. http://patorjk.com/software/taag/#p =display&f=henry%203d&t=cc11001100%0a This is more commonly used, can be generated according to the character of the input characters drawn

2. https://spring-boot-banner-gen.cfapps.io/can convert the uploaded image into a text-like character painting, just feel the style comparison ghost animal (must not be admitted to my long ghost animal ...) ), this is my humble character painting ....

3. Http://www.degraeve.com/img2txt.php can be based on the online image URL to generate characters, such as the company can directly paste the address of the logo to create character painting, style is normal ...

A portrait of Zhang Huang:

.

Spring Boot note Custom boot banner

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.