springApplication 提供启动类的main方法,在许多情况下,您可以将其委托给静态spring应用程序。运行方法:
public static void main(String[] args) throws Exception { //设置 热启动不生效 也可以在 资源文件中配置spring.devtools.restart.enabled // System.setProperty("spring.devtools.restart.enabled", "false"); //SpringApplication.run(Example.class, args); SpringApplication application = new SpringApplication(Example.class); /* * Banner.Mode.OFF:关闭; * Banner.Mode.CONSOLE:控制台输出,默认方式; * Banner.Mode.LOG:日志输出方式; */ //application.setBannerMode(Banner.Mode.OFF); application.run(args); }
当启动后,可以查看日志系统
┬┴┬/ ̄\_/ ̄\
┬┴┬┴▏ ▏▔▔▔▔\
┴┬┴/\ / ﹨
┬┴∕ / )
┴┬▏ ● ▏
┬┴▏ ▔█
┴◢██◣ \__/ !
┬█████◣ /
┴█████████████◣
◢██████████████▆▄
█◤◢██◣◥█████████◤\
◥◢████ ████████◤ \
┴█████ ██████◤ ﹨
┬│ │█████◤ ▏
┴│ │ ▏
┬∕ ∕ /▔▔▔\ ∕
┴/___/﹨ ∕ ﹨ /\
#这个是springboot的版本号
1.5.4.RELEASE
#这个是springboot的版本号
(v1.5.4.RELEASE)
2017-06-10 13:24:25.406 INFO 69788 --- [ restartedMain] com.csg.Example : Starting Example on DESKTOP-F36IHM2 with PID 69788 (J:\work1\target\classes started by csg in J:\work1)
2017-06-10 13:24:25.406 INFO 69788 --- [ restartedMain] com.csg.Example : No active profile set, falling back to default profiles: default
2017-06-10 13:24:25.408 INFO 69788 --- [ restartedMain] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@4fc2d46b: startup date [Sat Jun 10 13:24:25 CST 2017]; root of context hierarchy
2017-06-10 13:24:25.568 INFO 69788 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 1111 (http)
2017-06-10 13:24:25.568 INFO 69788 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2017-06-10 13:24:25.568 INFO 69788 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.15
2017-06-10 13:24:25.577 INFO 69788 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
会记录下启动的每一个过程
启动失败后,也会有相应的错误描述信息。
***************************
APPLICATION FAILED TO START
***************************
Description:
The Tomcat connector configured to listen on port 1111 failed to start. The port may already be in use or the connector may be misconfigured.
Action:
Verify the connector's configuration, identify and stop any process that's listening on port 1111, or configure this application to listen on another port.