If we have used SpringBoot, then the following pattern will be familiar to us. When Springboot starts, the following pattern will be printed with the version number.
View the official SpringBoot documentation to find a description of the banner
The banner that is printed on start up can be changed by adding a banner.txt file to your classpath or by setting the spring.banner.location property to the location of such a file. If the file has an encoding other than UTF-8, you can set spring.banner .charset. In addition to a text file, you can also add a banner.gif, banner.jpg, or banner.png image file to your classpath or set the spring.banner.image.location property. Images are converted into an ASCII art representation and printed above any text banner.
Translated by Youdao
Can be changed on the console by adding a banner.txt file to the classpath or setting spring.banner Printed banner. Property points to the location of such a file. If the encoding of the file is not UTF-8, then spring.banner.charset can be set. In addition to text files, banners can also be added. Save a gif, banner.jpg or banner.png image file to the classpath or set spring.banner.image. location attribute. The image is converted to ASCII art form and printed on top of any text banner.
In IDEA, when you enter spring.banner in the SpringBoot configuration file, the following prompt will appear, which corresponds to the translated content above.
1. Custom banner
We create a new banner.txt file under the class path and draw the following pattern.
After the SpringBoot project is started, as follows, we have modified the banner.
We temporarily delete the banner.txt file and place the following image on the classpath with the name: banner.jpg.
Then configure the following content in the configuration file
After starting the SpringBoot project, the pattern As shown below, Springboot converts the image into ASCII pattern.
If we don’t want the pattern to appear at startup, then we need to modify the code of the SpringBoot startup class
Original code
public static void main(String[] args) { SpringApplication.run(SpringbootShiroApplication.class, args); }
Modified code
public static void main(String[] args) { SpringApplication app = new SpringApplication(SpringbootShiroApplication.class); app.setBannerMode(Banner.Mode.OFF); app.run(args); }
In this way, the pattern will not be printed when SpringBoot starts.
The above is the detailed content of How to modify the SpringBoot project startup banner. For more information, please follow other related articles on the PHP Chinese website!