SpringBoot starts banner changes

At the beginning of this article, let me show you a picture

Anyone who has used or seen springboot knows that this is the banner started by springboot. This article introduces how to customize the startup banner of springboot.

First introduce a website that can make custom banners, portal: http://patorjk.com/software/taag/#p=display&f=Graffiti&t=Type%20Something%20

Enter custom text in the yellow box, fill in the font in the red box, this article uses banner

    ___        _        _           _        ____    _  _      _        _  _      ___
   F __".     /.\      FJ          /.\      F __ ]  FJ  LJ    /.\      F L L]   ,"___". 
  J |--\ L   //_\\    J |         //_\\    J |--| L J \/ F   //_\\    J   \| L  FJ---L] 
  | |  J |  / ___ \   | |        / ___ \   | |  | | J\  /L  / ___ \   | |\   | J |  [""L
  F L__J | / L___J \  F L_____  / L___J \  F L__J J  F  J  / L___J \  F L\\  J | \___] |
 J______/FJ__L   J__LJ________LJ__L   J__LJ\______/F|____|J__L   J__LJ__L \\__LJ\_____/F
 |______F |__L   J__||________||__L   J__| J______F |____||__L   J__||__L  J__| J_____F 

Create a new banner.txt and put it under resources, you can see it when you start it

In addition, spring provides several types to set the banner:
1.${AnsiColor.BRIGHT_CYAN} to set the banner font, as shown in the figure

2. ${AnsiBackground.BRIGHT_CYAN} to set the background color of the banner, (this demo model is ugly, do not spray), as shown in the figure

3. ${AnsiStyle.UNDERLINE} sets the font style

There are also several versions related to the version. Here are two simple examples.

1. Add the configuration to the configuration file, as follows:

application.version=dalaoyang_v1

Add ${application.version} to the banner, start as shown in the figure

config file join

spring.application.name=dalaoyang

Add ${spring.application.name} to the banner, as shown in the figure

2. Use the version of springboot

Add ${spring-boot.version} to the banner, start as shown in the figure

Source code download: Da Lao Yang Code Cloud

Personal website: https://www.dalaoyang.cn

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325115908&siteId=291194637