Spring Boot 2.0 offers a number of new features, one of which is a little egg: dynamic Banner, let's take this to taste fresh today.
Configuration Dependencies
Using the Spring Boot 2 first, you need to replace the project dependencies with the 2.0 release that you just released, and now the Web site https://start.spring.io/also sets the Spring Boot 2.0 as the default version.
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId> spring-boot-starter-parent</artifactid>
<version>2.0.0.RELEASE</version>
</parent >
When set up, there is no specified version of the dependent package in the dependencies, and the 2.0.0.RELEASE dependent version is automatically used.
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
</dependencies>
Spring Boot 2.0 has just been released, some Maven warehouses have not yet been updated, and you can manually add the Spring boot official Maven repository if the dependent packages cannot be downloaded after the project is imported.
<repositories>
<repository>
<id>spring-milestones</id>
<name>spring milestones</name>
<url>https://repo.spring.io/libs-milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories >
Be prepared for the first time using Spring Boot 2.0, the full dependency package needs to be downloaded for about half an hour.
Spring Boot Replacement Banner
Let's take a look at how to replace the boot Banner in Spring Boot 1.0, which is really simple, just src/main/ Under the resources path, create a new Banner.txt file, and Banner.txt fill in the string content you want to print.
In general, we use third-party tools to help transform content, such as Web site http://www.network-science.de/ascii/text into a string, Web site: http://www.degraeve.com/img2txt.php can convert the image into a string.
We tested it with Hello World as a startup string:
.__ .__ .__ .__ .___
| | __ ____ | | | | ____ __ _ _____________| | __| _/
| | \_/ __ \| | | | / _ \ \ \/ \/ / _ \_ __ \ | / __ |
| Y \ ___/| | _| | _ ( <_>) ( <_>) | \/ |__//_/|
| ___| /\___ >____/____/\____/ \/\_/\____/|__| | ____/\____ |
\/ \/
Create a new Banner.txt file under the Spring Boot 2.0 Project src/main/resources path, paste the string above, start the Spring Boot Project observation startup log, and discover that Spring Boot 2.0 has already set the default spring The string is replaced with Hello world. Description Spring Boot 2.0 also supports the 1.0 method of replacing Banner.
Next, test the print dynamic Banner in the Spring Boot 2.0 project, using the GIF below:
Similarly, we put the Banner.gif file in the project's src/main/resources path, start the project to test, the output column print information as follows:
..
.::*
... ..... ....
........ . ...
........ .
.. ...... ....
.... ...
.
. ..
**::**..
.*::::::::::*.
.*::::::::::::*. .*::::::::::::*.
.*::::::::::::*.
.*::::::::::*. ..
**::***.
.. .....
.. ..... ...
...... ......
. ... . .....
. .... .
. ............................ .............
.................. ......... ..........
...... . ................... ... . ... ............
............. . ... ...............
. ......... ...........
.......... ....... ....
............ ........
........ ........
.... . .........
........ ........
......... .. ********..
......*.. ........ . **::::::::::::**. ........
........... . **::::::::::::::::**. .......
...... . *::::::::::::::::::::*. ...