• Spring Cloud微服务实战 打造企业级优惠券系统 3-2 SpringBoot应用启动入口


    0    课程地址

    https://coding.imooc.com/lesson/380.html#mid=28270

    1    主要内容
    1.1  主要内容

    springboot应用启动的三种方式

    2    个人收获
    2.1  不同的启动方式

    通过api调用应用行为方式启动

     //第二种方式启动
            SpringApplication springApplication = new SpringApplication(SpringBootStudyApplication.class);
            //关掉打印logo相关日志
            springApplication.setBannerMode(Banner.Mode.OFF);
            //非wub启动,控制台启动后会关闭,不会一直保持开启状态
            springApplication.setWebApplicationType(WebApplicationType.NONE);
            springApplication.run(args);

    spingapplicationbuilder 链式调用

    //第三种方式启动 链式调用
            new SpringApplicationBuilder(SpringBootStudyApplication.class)
                    .bannerMode(Banner.Mode.OFF)
                    .web(WebApplicationType.NONE).run(args);
    2.2  启动方式的一些配置
         //关掉打印logo相关日志
            springApplication.setBannerMode(Banner.Mode.OFF);
            //非wub启动,控制台启动后会关闭,不会一直保持开启状态,此外还可以通过WebApplicationType的其他变量转换不同的启动方式
            springApplication.setWebApplicationType(WebApplicationType.NONE);
    3    课程内容
    3.1  第一种启动方式:

    顶类:

    package com.imooc.springboot.application;
    
    import org.springframework.boot.Banner;
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.WebApplicationType;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.boot.builder.SpringApplicationBuilder;
    
    /**
     * SpringBootApplication
     *
     * @author 魏豆豆
     * @date 2021/1/13
     */
    @SpringBootApplication
    public class SpringBootStudyApplication {
        public static void main(String [] args){
            //第一种方式启动
            SpringApplication.run(SpringBootStudyApplication.class,args);
    
            //第二种方式启动
          /*  SpringApplication springApplication = new SpringApplication(SpringBootStudyApplication.class);
            //关掉打印logo相关日志
            springApplication.setBannerMode(Banner.Mode.OFF);
            //非wub启动,控制台启动后会关闭,不会一直保持开启状态
            springApplication.setWebApplicationType(WebApplicationType.NONE);
            springApplication.run(args);
    
            //第三种方式启动 链式调用
            new SpringApplicationBuilder(SpringBootStudyApplication.class)
                    .bannerMode(Banner.Mode.OFF)
                    .web(WebApplicationType.NONE).run(args);*/
        }
    
    }

    打印日志:

    D:javajdkjdk8jdkinjava.exe "-javaagent:D:javadevolopKitideaanZhIntelliJ IDEA Community Edition 2018.1.4libidea_rt.jar=58977:D:javadevolopKitideaanZhIntelliJ IDEA Community Edition 2018.1.4in" -Dfile.encoding=UTF-8 -classpath D:javajdkjdk8jdkjrelibcharsets.jar;D:javajdkjdk8jdkjrelibdeploy.jar;D:javajdkjdk8jdkjrelibextaccess-bridge-64.jar;D:javajdkjdk8jdkjrelibextcldrdata.jar;D:javajdkjdk8jdkjrelibextdnsns.jar;D:javajdkjdk8jdkjrelibextjaccess.jar;D:javajdkjdk8jdkjrelibextjfxrt.jar;D:javajdkjdk8jdkjrelibextlocaledata.jar;D:javajdkjdk8jdkjrelibext
    ashorn.jar;D:javajdkjdk8jdkjrelibextsunec.jar;D:javajdkjdk8jdkjrelibextsunjce_provider.jar;D:javajdkjdk8jdkjrelibextsunmscapi.jar;D:javajdkjdk8jdkjrelibextsunpkcs11.jar;D:javajdkjdk8jdkjrelibextzipfs.jar;D:javajdkjdk8jdkjrelibjavaws.jar;D:javajdkjdk8jdkjrelibjce.jar;D:javajdkjdk8jdkjrelibjfr.jar;D:javajdkjdk8jdkjrelibjfxswt.jar;D:javajdkjdk8jdkjrelibjsse.jar;D:javajdkjdk8jdkjrelibmanagement-agent.jar;D:javajdkjdk8jdkjrelibplugin.jar;D:javajdkjdk8jdkjrelib
    esources.jar;D:javajdkjdk8jdkjrelib
    t.jar;F:kewaiSpringCloudlaoqinchapter_3imooc_springboot_study	argetclasses;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-starter-web2.1.4.RELEASEspring-boot-starter-web-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-starter2.1.4.RELEASEspring-boot-starter-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot2.1.4.RELEASEspring-boot-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-autoconfigure2.1.4.RELEASEspring-boot-autoconfigure-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-starter-logging2.1.4.RELEASEspring-boot-starter-logging-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositorychqoslogbacklogback-classic1.2.3logback-classic-1.2.3.jar;C:Usersweijingli.m2
    epositorychqoslogbacklogback-core1.2.3logback-core-1.2.3.jar;C:Usersweijingli.m2
    epositoryorgapachelogginglog4jlog4j-to-slf4j2.11.2log4j-to-slf4j-2.11.2.jar;C:Usersweijingli.m2
    epositoryorgapachelogginglog4jlog4j-api2.11.2log4j-api-2.11.2.jar;C:Usersweijingli.m2
    epositoryorgslf4jjul-to-slf4j1.7.26jul-to-slf4j-1.7.26.jar;C:Usersweijingli.m2
    epositoryjavaxannotationjavax.annotation-api1.3.2javax.annotation-api-1.3.2.jar;C:Usersweijingli.m2
    epositoryorgyamlsnakeyaml1.23snakeyaml-1.23.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-starter-json2.1.4.RELEASEspring-boot-starter-json-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositorycomfasterxmljacksoncorejackson-databind2.9.8jackson-databind-2.9.8.jar;C:Usersweijingli.m2
    epositorycomfasterxmljacksoncorejackson-annotations2.9.0jackson-annotations-2.9.0.jar;C:Usersweijingli.m2
    epositorycomfasterxmljacksoncorejackson-core2.9.8jackson-core-2.9.8.jar;C:Usersweijingli.m2
    epositorycomfasterxmljacksondatatypejackson-datatype-jdk82.9.8jackson-datatype-jdk8-2.9.8.jar;C:Usersweijingli.m2
    epositorycomfasterxmljacksondatatypejackson-datatype-jsr3102.9.8jackson-datatype-jsr310-2.9.8.jar;C:Usersweijingli.m2
    epositorycomfasterxmljacksonmodulejackson-module-parameter-names2.9.8jackson-module-parameter-names-2.9.8.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-starter-tomcat2.1.4.RELEASEspring-boot-starter-tomcat-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgapache	omcatembed	omcat-embed-core9.0.17	omcat-embed-core-9.0.17.jar;C:Usersweijingli.m2
    epositoryorgapache	omcatembed	omcat-embed-el9.0.17	omcat-embed-el-9.0.17.jar;C:Usersweijingli.m2
    epositoryorgapache	omcatembed	omcat-embed-websocket9.0.17	omcat-embed-websocket-9.0.17.jar;C:Usersweijingli.m2
    epositoryorghibernatevalidatorhibernate-validator6.0.16.Finalhibernate-validator-6.0.16.Final.jar;C:Usersweijingli.m2
    epositoryjavaxvalidationvalidation-api2.0.1.Finalvalidation-api-2.0.1.Final.jar;C:Usersweijingli.m2
    epositoryorgjbossloggingjboss-logging3.3.2.Finaljboss-logging-3.3.2.Final.jar;C:Usersweijingli.m2
    epositorycomfasterxmlclassmate1.4.0classmate-1.4.0.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-web5.1.6.RELEASEspring-web-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-beans5.1.6.RELEASEspring-beans-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-webmvc5.1.6.RELEASEspring-webmvc-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-aop5.1.6.RELEASEspring-aop-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-context5.1.6.RELEASEspring-context-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-expression5.1.6.RELEASEspring-expression-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgprojectlomboklombok1.18.6lombok-1.18.6.jar;C:Usersweijingli.m2
    epositoryorgslf4jslf4j-api1.7.26slf4j-api-1.7.26.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-core5.1.6.RELEASEspring-core-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-jcl5.1.6.RELEASEspring-jcl-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositorycomalibabafastjson1.2.31fastjson-1.2.31.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-configuration-processor2.1.4.RELEASEspring-boot-configuration-processor-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-starter-actuator2.1.4.RELEASEspring-boot-starter-actuator-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-actuator-autoconfigure2.1.4.RELEASEspring-boot-actuator-autoconfigure-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-actuator2.1.4.RELEASEspring-boot-actuator-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryiomicrometermicrometer-core1.1.4micrometer-core-1.1.4.jar;C:Usersweijingli.m2
    epositoryorghdrhistogramHdrHistogram2.1.9HdrHistogram-2.1.9.jar;C:Usersweijingli.m2
    epositoryorglatencyutilsLatencyUtils2.0.3LatencyUtils-2.0.3.jar com.imooc.springboot.application.SpringBootStudyApplication
    
      .   ____          _            __ _ _
     /\ / ___'_ __ _ _(_)_ __  __ _    
    ( ( )\___ | '_ | '_| | '_ / _` |    
     \/  ___)| |_)| | | | | || (_| |  ) ) ) )
      '  |____| .__|_| |_|_| |_\__, | / / / /
     =========|_|==============|___/=/_/_/_/
     :: Spring Boot ::        (v2.1.4.RELEASE)
    
    2021-01-14 07:14:39.891  INFO 14528 --- [           main] c.i.s.a.SpringBootStudyApplication       : Starting SpringBootStudyApplication on DESKTOP-A08HONB with PID 14528 (F:kewaiSpringCloudlaoqinchapter_3imooc_springboot_study	argetclasses started by weijingli in F:kewaiSpringCloudlaoqinchapter_3imooc_springboot_study)
    2021-01-14 07:14:39.900  INFO 14528 --- [           main] c.i.s.a.SpringBootStudyApplication       : No active profile set, falling back to default profiles: default
    2021-01-14 07:14:43.183 ERROR 14528 --- [           main] o.a.catalina.core.AprLifecycleListener   : An incompatible version [1.1.32] of the APR based Apache Tomcat Native library is installed, while Tomcat requires version [1.2.14]
    2021-01-14 07:14:44.685 ERROR 14528 --- [           main] o.a.catalina.core.AprLifecycleListener   : An incompatible version [1.1.32] of the APR based Apache Tomcat Native library is installed, while Tomcat requires version [1.2.14]
    2021-01-14 07:14:44.897  INFO 14528 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
    2021-01-14 07:14:44.924 ERROR 14528 --- [           main] o.a.catalina.core.AprLifecycleListener   : An incompatible version [1.1.32] of the APR based Apache Tomcat Native library is installed, while Tomcat requires version [1.2.14]
    2021-01-14 07:14:44.943  INFO 14528 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
    2021-01-14 07:14:44.943  INFO 14528 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.17]
    2021-01-14 07:14:45.332  INFO 14528 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
    2021-01-14 07:14:45.334  INFO 14528 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 5313 ms
    2021-01-14 07:14:46.593  INFO 14528 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
    2021-01-14 07:14:47.147  INFO 14528 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
    2021-01-14 07:14:47.331  INFO 14528 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
    2021-01-14 07:14:47.336  INFO 14528 --- [           main] c.i.s.a.SpringBootStudyApplication       : Started SpringBootStudyApplication in 8.317 seconds (JVM running for 9.589)
    3.2  第二种启动方式:(通过api调用应用行为方式启动)

    顶类:

    package com.imooc.springboot.application;
    
    import org.springframework.boot.Banner;
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.WebApplicationType;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.boot.builder.SpringApplicationBuilder;
    
    /**
     * SpringBootApplication
     *
     * @author 魏豆豆
     * @date 2021/1/13
     */
    @SpringBootApplication
    public class SpringBootStudyApplication {
        public static void main(String [] args){
            //第一种方式启动
            //SpringApplication.run(SpringBootStudyApplication.class,args);
    
            //第二种方式启动
            SpringApplication springApplication = new SpringApplication(SpringBootStudyApplication.class);
            //关掉打印logo相关日志
            springApplication.setBannerMode(Banner.Mode.OFF);
            //非wub启动,控制台启动后会关闭,不会一直保持开启状态,此配置关闭能打印端口等配置信息
            springApplication.setWebApplicationType(WebApplicationType.NONE);
            springApplication.run(args);
    
            //第三种方式启动 链式调用
           /* new SpringApplicationBuilder(SpringBootStudyApplication.class)
                    .bannerMode(Banner.Mode.OFF)
                    .web(WebApplicationType.NONE).run(args);*/
        }
    
    }

    打印日志:

    D:javajdkjdk8jdkinjava.exe "-javaagent:D:javadevolopKitideaanZhIntelliJ IDEA Community Edition 2018.1.4libidea_rt.jar=59101:D:javadevolopKitideaanZhIntelliJ IDEA Community Edition 2018.1.4in" -Dfile.encoding=UTF-8 -classpath D:javajdkjdk8jdkjrelibcharsets.jar;D:javajdkjdk8jdkjrelibdeploy.jar;D:javajdkjdk8jdkjrelibextaccess-bridge-64.jar;D:javajdkjdk8jdkjrelibextcldrdata.jar;D:javajdkjdk8jdkjrelibextdnsns.jar;D:javajdkjdk8jdkjrelibextjaccess.jar;D:javajdkjdk8jdkjrelibextjfxrt.jar;D:javajdkjdk8jdkjrelibextlocaledata.jar;D:javajdkjdk8jdkjrelibext
    ashorn.jar;D:javajdkjdk8jdkjrelibextsunec.jar;D:javajdkjdk8jdkjrelibextsunjce_provider.jar;D:javajdkjdk8jdkjrelibextsunmscapi.jar;D:javajdkjdk8jdkjrelibextsunpkcs11.jar;D:javajdkjdk8jdkjrelibextzipfs.jar;D:javajdkjdk8jdkjrelibjavaws.jar;D:javajdkjdk8jdkjrelibjce.jar;D:javajdkjdk8jdkjrelibjfr.jar;D:javajdkjdk8jdkjrelibjfxswt.jar;D:javajdkjdk8jdkjrelibjsse.jar;D:javajdkjdk8jdkjrelibmanagement-agent.jar;D:javajdkjdk8jdkjrelibplugin.jar;D:javajdkjdk8jdkjrelib
    esources.jar;D:javajdkjdk8jdkjrelib
    t.jar;F:kewaiSpringCloudlaoqinchapter_3imooc_springboot_study	argetclasses;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-starter-web2.1.4.RELEASEspring-boot-starter-web-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-starter2.1.4.RELEASEspring-boot-starter-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot2.1.4.RELEASEspring-boot-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-autoconfigure2.1.4.RELEASEspring-boot-autoconfigure-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-starter-logging2.1.4.RELEASEspring-boot-starter-logging-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositorychqoslogbacklogback-classic1.2.3logback-classic-1.2.3.jar;C:Usersweijingli.m2
    epositorychqoslogbacklogback-core1.2.3logback-core-1.2.3.jar;C:Usersweijingli.m2
    epositoryorgapachelogginglog4jlog4j-to-slf4j2.11.2log4j-to-slf4j-2.11.2.jar;C:Usersweijingli.m2
    epositoryorgapachelogginglog4jlog4j-api2.11.2log4j-api-2.11.2.jar;C:Usersweijingli.m2
    epositoryorgslf4jjul-to-slf4j1.7.26jul-to-slf4j-1.7.26.jar;C:Usersweijingli.m2
    epositoryjavaxannotationjavax.annotation-api1.3.2javax.annotation-api-1.3.2.jar;C:Usersweijingli.m2
    epositoryorgyamlsnakeyaml1.23snakeyaml-1.23.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-starter-json2.1.4.RELEASEspring-boot-starter-json-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositorycomfasterxmljacksoncorejackson-databind2.9.8jackson-databind-2.9.8.jar;C:Usersweijingli.m2
    epositorycomfasterxmljacksoncorejackson-annotations2.9.0jackson-annotations-2.9.0.jar;C:Usersweijingli.m2
    epositorycomfasterxmljacksoncorejackson-core2.9.8jackson-core-2.9.8.jar;C:Usersweijingli.m2
    epositorycomfasterxmljacksondatatypejackson-datatype-jdk82.9.8jackson-datatype-jdk8-2.9.8.jar;C:Usersweijingli.m2
    epositorycomfasterxmljacksondatatypejackson-datatype-jsr3102.9.8jackson-datatype-jsr310-2.9.8.jar;C:Usersweijingli.m2
    epositorycomfasterxmljacksonmodulejackson-module-parameter-names2.9.8jackson-module-parameter-names-2.9.8.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-starter-tomcat2.1.4.RELEASEspring-boot-starter-tomcat-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgapache	omcatembed	omcat-embed-core9.0.17	omcat-embed-core-9.0.17.jar;C:Usersweijingli.m2
    epositoryorgapache	omcatembed	omcat-embed-el9.0.17	omcat-embed-el-9.0.17.jar;C:Usersweijingli.m2
    epositoryorgapache	omcatembed	omcat-embed-websocket9.0.17	omcat-embed-websocket-9.0.17.jar;C:Usersweijingli.m2
    epositoryorghibernatevalidatorhibernate-validator6.0.16.Finalhibernate-validator-6.0.16.Final.jar;C:Usersweijingli.m2
    epositoryjavaxvalidationvalidation-api2.0.1.Finalvalidation-api-2.0.1.Final.jar;C:Usersweijingli.m2
    epositoryorgjbossloggingjboss-logging3.3.2.Finaljboss-logging-3.3.2.Final.jar;C:Usersweijingli.m2
    epositorycomfasterxmlclassmate1.4.0classmate-1.4.0.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-web5.1.6.RELEASEspring-web-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-beans5.1.6.RELEASEspring-beans-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-webmvc5.1.6.RELEASEspring-webmvc-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-aop5.1.6.RELEASEspring-aop-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-context5.1.6.RELEASEspring-context-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-expression5.1.6.RELEASEspring-expression-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgprojectlomboklombok1.18.6lombok-1.18.6.jar;C:Usersweijingli.m2
    epositoryorgslf4jslf4j-api1.7.26slf4j-api-1.7.26.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-core5.1.6.RELEASEspring-core-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-jcl5.1.6.RELEASEspring-jcl-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositorycomalibabafastjson1.2.31fastjson-1.2.31.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-configuration-processor2.1.4.RELEASEspring-boot-configuration-processor-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-starter-actuator2.1.4.RELEASEspring-boot-starter-actuator-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-actuator-autoconfigure2.1.4.RELEASEspring-boot-actuator-autoconfigure-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-actuator2.1.4.RELEASEspring-boot-actuator-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryiomicrometermicrometer-core1.1.4micrometer-core-1.1.4.jar;C:Usersweijingli.m2
    epositoryorghdrhistogramHdrHistogram2.1.9HdrHistogram-2.1.9.jar;C:Usersweijingli.m2
    epositoryorglatencyutilsLatencyUtils2.0.3LatencyUtils-2.0.3.jar com.imooc.springboot.application.SpringBootStudyApplication
    2021-01-14 07:15:35.944  INFO 15928 --- [           main] c.i.s.a.SpringBootStudyApplication       : Starting SpringBootStudyApplication on DESKTOP-A08HONB with PID 15928 (F:kewaiSpringCloudlaoqinchapter_3imooc_springboot_study	argetclasses started by weijingli in F:kewaiSpringCloudlaoqinchapter_3imooc_springboot_study)
    2021-01-14 07:15:35.951  INFO 15928 --- [           main] c.i.s.a.SpringBootStudyApplication       : No active profile set, falling back to default profiles: default
    2021-01-14 07:15:39.933  INFO 15928 --- [           main] c.i.s.a.SpringBootStudyApplication       : Started SpringBootStudyApplication in 4.836 seconds (JVM running for 6.158)
    
    Process finished with exit code 0
    3.3  第三种启动方式:(spingapplicationbuilder 链式调用)

    顶类:

    package com.imooc.springboot.application;
    
    import org.springframework.boot.Banner;
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.WebApplicationType;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.boot.builder.SpringApplicationBuilder;
    
    /**
     * SpringBootApplication
     *
     * @author 魏豆豆
     * @date 2021/1/13
     */
    @SpringBootApplication
    public class SpringBootStudyApplication {
        public static void main(String [] args){
            //第一种方式启动
            //SpringApplication.run(SpringBootStudyApplication.class,args);
    
            //第二种方式启动
            /*SpringApplication springApplication = new SpringApplication(SpringBootStudyApplication.class);
            //关掉打印logo相关日志
            springApplication.setBannerMode(Banner.Mode.OFF);
            //非web启动,控制台启动后会关闭,不会一直保持开启状态,此配置关闭还能打印端口等信息
            springApplication.setWebApplicationType(WebApplicationType.NONE);
            springApplication.run(args);*/
    
            //第三种方式启动 链式调用
            new SpringApplicationBuilder(SpringBootStudyApplication.class)
                    .bannerMode(Banner.Mode.OFF)
                    .web(WebApplicationType.NONE).run(args);
        }
    
    }

    打印日志:

    D:javajdkjdk8jdkinjava.exe "-javaagent:D:javadevolopKitideaanZhIntelliJ IDEA Community Edition 2018.1.4libidea_rt.jar=59250:D:javadevolopKitideaanZhIntelliJ IDEA Community Edition 2018.1.4in" -Dfile.encoding=UTF-8 -classpath D:javajdkjdk8jdkjrelibcharsets.jar;D:javajdkjdk8jdkjrelibdeploy.jar;D:javajdkjdk8jdkjrelibextaccess-bridge-64.jar;D:javajdkjdk8jdkjrelibextcldrdata.jar;D:javajdkjdk8jdkjrelibextdnsns.jar;D:javajdkjdk8jdkjrelibextjaccess.jar;D:javajdkjdk8jdkjrelibextjfxrt.jar;D:javajdkjdk8jdkjrelibextlocaledata.jar;D:javajdkjdk8jdkjrelibext
    ashorn.jar;D:javajdkjdk8jdkjrelibextsunec.jar;D:javajdkjdk8jdkjrelibextsunjce_provider.jar;D:javajdkjdk8jdkjrelibextsunmscapi.jar;D:javajdkjdk8jdkjrelibextsunpkcs11.jar;D:javajdkjdk8jdkjrelibextzipfs.jar;D:javajdkjdk8jdkjrelibjavaws.jar;D:javajdkjdk8jdkjrelibjce.jar;D:javajdkjdk8jdkjrelibjfr.jar;D:javajdkjdk8jdkjrelibjfxswt.jar;D:javajdkjdk8jdkjrelibjsse.jar;D:javajdkjdk8jdkjrelibmanagement-agent.jar;D:javajdkjdk8jdkjrelibplugin.jar;D:javajdkjdk8jdkjrelib
    esources.jar;D:javajdkjdk8jdkjrelib
    t.jar;F:kewaiSpringCloudlaoqinchapter_3imooc_springboot_study	argetclasses;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-starter-web2.1.4.RELEASEspring-boot-starter-web-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-starter2.1.4.RELEASEspring-boot-starter-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot2.1.4.RELEASEspring-boot-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-autoconfigure2.1.4.RELEASEspring-boot-autoconfigure-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-starter-logging2.1.4.RELEASEspring-boot-starter-logging-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositorychqoslogbacklogback-classic1.2.3logback-classic-1.2.3.jar;C:Usersweijingli.m2
    epositorychqoslogbacklogback-core1.2.3logback-core-1.2.3.jar;C:Usersweijingli.m2
    epositoryorgapachelogginglog4jlog4j-to-slf4j2.11.2log4j-to-slf4j-2.11.2.jar;C:Usersweijingli.m2
    epositoryorgapachelogginglog4jlog4j-api2.11.2log4j-api-2.11.2.jar;C:Usersweijingli.m2
    epositoryorgslf4jjul-to-slf4j1.7.26jul-to-slf4j-1.7.26.jar;C:Usersweijingli.m2
    epositoryjavaxannotationjavax.annotation-api1.3.2javax.annotation-api-1.3.2.jar;C:Usersweijingli.m2
    epositoryorgyamlsnakeyaml1.23snakeyaml-1.23.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-starter-json2.1.4.RELEASEspring-boot-starter-json-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositorycomfasterxmljacksoncorejackson-databind2.9.8jackson-databind-2.9.8.jar;C:Usersweijingli.m2
    epositorycomfasterxmljacksoncorejackson-annotations2.9.0jackson-annotations-2.9.0.jar;C:Usersweijingli.m2
    epositorycomfasterxmljacksoncorejackson-core2.9.8jackson-core-2.9.8.jar;C:Usersweijingli.m2
    epositorycomfasterxmljacksondatatypejackson-datatype-jdk82.9.8jackson-datatype-jdk8-2.9.8.jar;C:Usersweijingli.m2
    epositorycomfasterxmljacksondatatypejackson-datatype-jsr3102.9.8jackson-datatype-jsr310-2.9.8.jar;C:Usersweijingli.m2
    epositorycomfasterxmljacksonmodulejackson-module-parameter-names2.9.8jackson-module-parameter-names-2.9.8.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-starter-tomcat2.1.4.RELEASEspring-boot-starter-tomcat-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgapache	omcatembed	omcat-embed-core9.0.17	omcat-embed-core-9.0.17.jar;C:Usersweijingli.m2
    epositoryorgapache	omcatembed	omcat-embed-el9.0.17	omcat-embed-el-9.0.17.jar;C:Usersweijingli.m2
    epositoryorgapache	omcatembed	omcat-embed-websocket9.0.17	omcat-embed-websocket-9.0.17.jar;C:Usersweijingli.m2
    epositoryorghibernatevalidatorhibernate-validator6.0.16.Finalhibernate-validator-6.0.16.Final.jar;C:Usersweijingli.m2
    epositoryjavaxvalidationvalidation-api2.0.1.Finalvalidation-api-2.0.1.Final.jar;C:Usersweijingli.m2
    epositoryorgjbossloggingjboss-logging3.3.2.Finaljboss-logging-3.3.2.Final.jar;C:Usersweijingli.m2
    epositorycomfasterxmlclassmate1.4.0classmate-1.4.0.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-web5.1.6.RELEASEspring-web-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-beans5.1.6.RELEASEspring-beans-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-webmvc5.1.6.RELEASEspring-webmvc-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-aop5.1.6.RELEASEspring-aop-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-context5.1.6.RELEASEspring-context-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-expression5.1.6.RELEASEspring-expression-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgprojectlomboklombok1.18.6lombok-1.18.6.jar;C:Usersweijingli.m2
    epositoryorgslf4jslf4j-api1.7.26slf4j-api-1.7.26.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-core5.1.6.RELEASEspring-core-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkspring-jcl5.1.6.RELEASEspring-jcl-5.1.6.RELEASE.jar;C:Usersweijingli.m2
    epositorycomalibabafastjson1.2.31fastjson-1.2.31.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-configuration-processor2.1.4.RELEASEspring-boot-configuration-processor-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-starter-actuator2.1.4.RELEASEspring-boot-starter-actuator-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-actuator-autoconfigure2.1.4.RELEASEspring-boot-actuator-autoconfigure-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryorgspringframeworkootspring-boot-actuator2.1.4.RELEASEspring-boot-actuator-2.1.4.RELEASE.jar;C:Usersweijingli.m2
    epositoryiomicrometermicrometer-core1.1.4micrometer-core-1.1.4.jar;C:Usersweijingli.m2
    epositoryorghdrhistogramHdrHistogram2.1.9HdrHistogram-2.1.9.jar;C:Usersweijingli.m2
    epositoryorglatencyutilsLatencyUtils2.0.3LatencyUtils-2.0.3.jar com.imooc.springboot.application.SpringBootStudyApplication
    2021-01-14 07:16:45.756  INFO 20384 --- [           main] c.i.s.a.SpringBootStudyApplication       : Starting SpringBootStudyApplication on DESKTOP-A08HONB with PID 20384 (F:kewaiSpringCloudlaoqinchapter_3imooc_springboot_study	argetclasses started by weijingli in F:kewaiSpringCloudlaoqinchapter_3imooc_springboot_study)
    2021-01-14 07:16:45.763  INFO 20384 --- [           main] c.i.s.a.SpringBootStudyApplication       : No active profile set, falling back to default profiles: default
    2021-01-14 07:16:49.078  INFO 20384 --- [           main] c.i.s.a.SpringBootStudyApplication       : Started SpringBootStudyApplication in 4.154 seconds (JVM running for 5.267)
    
    Process finished with exit code 0
    诸葛
  • 相关阅读:
    jsp三种注释方法
    MyEclipse 2015优化技巧
    查看是否安装jdk及路径
    hibernate中save()、get()、load()、update()、saveorupdate()、merge()等方法
    MyEclipse更改项目名web发布名字不改问题
    try-catch-finally try中有rerun 是否执行finally
    使用HTML制作网页
    rs(0)与rs("字段名")的区别
    金蝶K3 wise 插件二次开发与配置
    初识触发器(2)
  • 原文地址:https://www.cnblogs.com/1446358788-qq/p/14275323.html
Copyright © 2020-2023  润新知