Springboot启动自定义Banner
2019-09-23 本文已影响0人
iDevOps
正常启动Springboot会输出一下内容
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.7.RELEASE)
2019-09-03 10:12:38.932 INFO 10180 --- [ restartedMain] com.example.mybatis.MybatisApplication : Starting MybatisApplication on PC-20190618OOCA with PID 10180 (E:\Workspace\java\test\mybatis\target\classes started by Administrator in E:\Workspace\java\test\mybatis)
2019-09-03 10:12:38.947 INFO 10180 --- [ restartedMain] com.example.mybatis.MybatisApplication : No active profile set, falling back to default profiles: default
2019-09-03 10:12:38.984 INFO 10180 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2019-09-03 10:12:38.985 INFO 10180 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2019-09-03 10:12:40.444 INFO 10180 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-09-03 10:12:40.464 INFO 10180 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-09-03 10:12:40.464 INFO 10180 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.22]
2019-09-03 10:12:40.543 INFO 10180 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-09-03 10:12:40.543 INFO 10180 --- [ restartedMain] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1558 ms
2019-09-03 10:12:40.710 INFO 10180 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-09-03 10:12:40.871 INFO 10180 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2019-09-03 10:12:40.947 INFO 10180 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2019-09-03 10:12:40.950 INFO 10180 --- [ restartedMain] com.example.mybatis.MybatisApplication : Started MybatisApplication in 2.757 seconds (JVM running for 4.19)
在resources下创建banner.txt
banner.txt
Hello Springboot!!!
这个时候再启动Springboot
Hello Springboot!!!
2019-09-03 10:16:36.845 INFO 9636 --- [ restartedMain] com.example.mybatis.MybatisApplication : Starting MybatisApplication on PC-20190618OOCA with PID 9636 (E:\Workspace\java\test\mybatis\target\classes started by Administrator in E:\Workspace\java\test\mybatis)
2019-09-03 10:16:36.847 INFO 9636 --- [ restartedMain] com.example.mybatis.MybatisApplication : No active profile set, falling back to default profiles: default
2019-09-03 10:16:36.884 INFO 9636 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2019-09-03 10:16:36.885 INFO 9636 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2019-09-03 10:16:37.943 INFO 9636 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-09-03 10:16:37.971 INFO 9636 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-09-03 10:16:37.971 INFO 9636 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.22]
2019-09-03 10:16:38.050 INFO 9636 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-09-03 10:16:38.050 INFO 9636 --- [ restartedMain] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1165 ms
2019-09-03 10:16:38.245 INFO 9636 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-09-03 10:16:38.426 INFO 9636 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2019-09-03 10:16:38.474 INFO 9636 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2019-09-03 10:16:38.477 INFO 9636 --- [ restartedMain] com.example.mybatis.MybatisApplication : Started MybatisApplication in 1.989 seconds (JVM running for 2.724)
怎么让我们的输出更炫一点呢, 点我
修改我们的banner.txt
___ ___ .__ .__ _________ .__ ___. __ ._._._.
/ | \ ____ | | | | ____ / _____/____________|__| ____ ____\_ |__ ____ _____/ |_| | | |
/ ~ \_/ __ \| | | | / _ \ \_____ \\____ \_ __ \ |/ \ / ___\| __ \ / _ \ / _ \ __\ | | |
\ Y /\ ___/| |_| |_( <_> ) / \ |_> > | \/ | | \/ /_/ > \_\ ( <_> | <_> ) | \|\|\|
\___|_ / \___ >____/____/\____/ /_______ / __/|__| |__|___| /\___ /|___ /\____/ \____/|__| ______
\/ \/ \/|__| \//_____/ \/ \/\/\/
这时启动Springboot就会输出上面的内容