• 十三,springBoot整合junit


    1.依赖

    <!--        junit-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>compile</scope>
            </dependency>
    <!--        <dependency>-->
    <!--千万看清楚原来项目是否有下面的依赖,有的话注释掉            
              <groupId>org.springframework.boot</groupId>
    --> <!-- <artifactId>spring-boot-starter-test</artifactId>--> <!-- <scope>test</scope>--> <!-- <exclusions>--> <!-- <exclusion>--> <!-- <groupId>org.junit.vintage</groupId>--> <!-- <artifactId>junit-vintage-engine</artifactId>--> <!-- </exclusion>--> <!-- </exclusions>--> <!-- </dependency>--> </dependencies>

    2.测试类:

    package com.example.test;
    
    import com.CleanSpringBootApplication;
    import com.example.pojo.User;
    import com.example.service.UserService;
    import org.junit.runner.RunWith;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.boot.test.context.SpringBootTest;
    import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
    
    import java.util.List;
    
    /**
     * @RunWith就是一个运行器
     * @RunWith(JUnit4.class)就是指用JUnit4来运行
     * @RunWith(SpringJUnit4ClassRunner.class),让测试运行于Spring测试环境,以便在测试开始的时候自动创建Spring的应用上下文
     * @RunWith(Suite.class)的话就是一套测试集合,
     * @ContextConfiguration Spring整合JUnit4测试时,使用注解引入多个配置文件
     * 单个文件 
     * @ContextConfiguration(Locations="classpath:applicationContext.xml")  
     * @ContextConfiguration(classes = SimpleConfiguration.class)
     * 多个文件时,可用{}
     * @ContextConfiguration(locations = { "classpath:spring1.xml", "classpath:spring2.xml" }) 
     */
    @RunWith(SpringJUnit4ClassRunner.class)//替换运行器
    @SpringBootTest(classes = CleanSpringBootApplication.class)//属性用于指定引导类,目的是加载ApplicationContext,启动spring容器。
    public class Test {
    
        @Autowired
        private UserService userService;
    
        @org.junit.Test
        public void test() {
            List<User> users = userService.findAll();
            System.out.println(users);
        }
    }

    控制台

    "C:Program FilesJavajdk-11.0.7injava.exe" -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:E:IntelliJ IDEA 2019.1libidea_rt.jar=3427:E:IntelliJ IDEA 2019.1in" -Dfile.encoding=UTF-8 -classpath "E:IntelliJ IDEA 2019.1libidea_rt.jar;E:IntelliJ IDEA 2019.1pluginsjunitlibjunit-rt.jar;E:IntelliJ IDEA 2019.1pluginsjunitlibjunit5-rt.jar;D:学习代码javacleanSpringBoot	arget	est-classes;D:学习代码javacleanSpringBoot	argetclasses;F:apache-maven-3.6.0
    epositoryorgspringframeworkootspring-boot-starter-web2.3.1.RELEASEspring-boot-starter-web-2.3.1.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkootspring-boot-starter2.3.1.RELEASEspring-boot-starter-2.3.1.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkootspring-boot-starter-logging2.3.1.RELEASEspring-boot-starter-logging-2.3.1.RELEASE.jar;F:apache-maven-3.6.0
    epositorychqoslogbacklogback-classic1.2.3logback-classic-1.2.3.jar;F:apache-maven-3.6.0
    epositorychqoslogbacklogback-core1.2.3logback-core-1.2.3.jar;F:apache-maven-3.6.0
    epositoryorgapachelogginglog4jlog4j-to-slf4j2.13.3log4j-to-slf4j-2.13.3.jar;F:apache-maven-3.6.0
    epositoryorgapachelogginglog4jlog4j-api2.13.3log4j-api-2.13.3.jar;F:apache-maven-3.6.0
    epositoryorgslf4jjul-to-slf4j1.7.30jul-to-slf4j-1.7.30.jar;F:apache-maven-3.6.0
    epositoryjakartaannotationjakarta.annotation-api1.3.5jakarta.annotation-api-1.3.5.jar;F:apache-maven-3.6.0
    epositoryorgyamlsnakeyaml1.26snakeyaml-1.26.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkootspring-boot-starter-json2.3.1.RELEASEspring-boot-starter-json-2.3.1.RELEASE.jar;F:apache-maven-3.6.0
    epositorycomfasterxmljacksoncorejackson-databind2.11.0jackson-databind-2.11.0.jar;F:apache-maven-3.6.0
    epositorycomfasterxmljacksoncorejackson-annotations2.11.0jackson-annotations-2.11.0.jar;F:apache-maven-3.6.0
    epositorycomfasterxmljacksoncorejackson-core2.11.0jackson-core-2.11.0.jar;F:apache-maven-3.6.0
    epositorycomfasterxmljacksondatatypejackson-datatype-jdk82.11.0jackson-datatype-jdk8-2.11.0.jar;F:apache-maven-3.6.0
    epositorycomfasterxmljacksondatatypejackson-datatype-jsr3102.11.0jackson-datatype-jsr310-2.11.0.jar;F:apache-maven-3.6.0
    epositorycomfasterxmljacksonmodulejackson-module-parameter-names2.11.0jackson-module-parameter-names-2.11.0.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkootspring-boot-starter-tomcat2.3.1.RELEASEspring-boot-starter-tomcat-2.3.1.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgapache	omcatembed	omcat-embed-core9.0.36	omcat-embed-core-9.0.36.jar;F:apache-maven-3.6.0
    epositoryorgglassfishjakarta.el3.0.3jakarta.el-3.0.3.jar;F:apache-maven-3.6.0
    epositoryorgapache	omcatembed	omcat-embed-websocket9.0.36	omcat-embed-websocket-9.0.36.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkspring-web5.2.7.RELEASEspring-web-5.2.7.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkspring-beans5.2.7.RELEASEspring-beans-5.2.7.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkspring-webmvc5.2.7.RELEASEspring-webmvc-5.2.7.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkspring-aop5.2.7.RELEASEspring-aop-5.2.7.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkspring-context5.2.7.RELEASEspring-context-5.2.7.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkspring-expression5.2.7.RELEASEspring-expression-5.2.7.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkootspring-boot-devtools2.3.1.RELEASEspring-boot-devtools-2.3.1.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkootspring-boot2.3.1.RELEASEspring-boot-2.3.1.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkootspring-boot-autoconfigure2.3.1.RELEASEspring-boot-autoconfigure-2.3.1.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkootspring-boot-starter-data-jpa2.3.1.RELEASEspring-boot-starter-data-jpa-2.3.1.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkootspring-boot-starter-aop2.3.1.RELEASEspring-boot-starter-aop-2.3.1.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgaspectjaspectjweaver1.9.5aspectjweaver-1.9.5.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkootspring-boot-starter-jdbc2.3.1.RELEASEspring-boot-starter-jdbc-2.3.1.RELEASE.jar;F:apache-maven-3.6.0
    epositorycomzaxxerHikariCP3.4.5HikariCP-3.4.5.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkspring-jdbc5.2.7.RELEASEspring-jdbc-5.2.7.RELEASE.jar;F:apache-maven-3.6.0
    epositoryjakarta	ransactionjakarta.transaction-api1.3.3jakarta.transaction-api-1.3.3.jar;F:apache-maven-3.6.0
    epositoryjakartapersistencejakarta.persistence-api2.2.3jakarta.persistence-api-2.2.3.jar;F:apache-maven-3.6.0
    epositoryorghibernatehibernate-core5.4.17.Finalhibernate-core-5.4.17.Final.jar;F:apache-maven-3.6.0
    epositoryorgjbossloggingjboss-logging3.4.1.Finaljboss-logging-3.4.1.Final.jar;F:apache-maven-3.6.0
    epositoryorgjavassistjavassist3.24.0-GAjavassist-3.24.0-GA.jar;F:apache-maven-3.6.0
    epository
    etytebuddyyte-buddy1.10.11yte-buddy-1.10.11.jar;F:apache-maven-3.6.0
    epositoryantlrantlr2.7.7antlr-2.7.7.jar;F:apache-maven-3.6.0
    epositoryorgjbossjandex2.1.3.Finaljandex-2.1.3.Final.jar;F:apache-maven-3.6.0
    epositorycomfasterxmlclassmate1.5.1classmate-1.5.1.jar;F:apache-maven-3.6.0
    epositoryorgdom4jdom4j2.1.3dom4j-2.1.3.jar;F:apache-maven-3.6.0
    epositoryorghibernatecommonhibernate-commons-annotations5.1.0.Finalhibernate-commons-annotations-5.1.0.Final.jar;F:apache-maven-3.6.0
    epositoryorgglassfishjaxbjaxb-runtime2.3.3jaxb-runtime-2.3.3.jar;F:apache-maven-3.6.0
    epositoryorgglassfishjaxb	xw22.3.3	xw2-2.3.3.jar;F:apache-maven-3.6.0
    epositorycomsunistackistack-commons-runtime3.0.11istack-commons-runtime-3.0.11.jar;F:apache-maven-3.6.0
    epositorycomsunactivationjakarta.activation1.2.2jakarta.activation-1.2.2.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkdataspring-data-jpa2.3.1.RELEASEspring-data-jpa-2.3.1.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkdataspring-data-commons2.3.1.RELEASEspring-data-commons-2.3.1.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkspring-orm5.2.7.RELEASEspring-orm-5.2.7.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkspring-tx5.2.7.RELEASEspring-tx-5.2.7.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgslf4jslf4j-api1.7.30slf4j-api-1.7.30.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkspring-aspects5.2.7.RELEASEspring-aspects-5.2.7.RELEASE.jar;F:apache-maven-3.6.0
    epositorymysqlmysql-connector-java8.0.20mysql-connector-java-8.0.20.jar;F:apache-maven-3.6.0
    epositoryorgmybatisspringootmybatis-spring-boot-starter1.1.1mybatis-spring-boot-starter-1.1.1.jar;F:apache-maven-3.6.0
    epositoryorgmybatisspringootmybatis-spring-boot-autoconfigure1.1.1mybatis-spring-boot-autoconfigure-1.1.1.jar;F:apache-maven-3.6.0
    epositoryorgmybatismybatis3.4.0mybatis-3.4.0.jar;F:apache-maven-3.6.0
    epositoryorgmybatismybatis-spring1.3.0mybatis-spring-1.3.0.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkootspring-boot-starter-redis1.3.8.RELEASEspring-boot-starter-redis-1.3.8.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkdataspring-data-redis2.3.1.RELEASEspring-data-redis-2.3.1.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkdataspring-data-keyvalue2.3.1.RELEASEspring-data-keyvalue-2.3.1.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkspring-oxm5.2.7.RELEASEspring-oxm-5.2.7.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkspring-context-support5.2.7.RELEASEspring-context-support-5.2.7.RELEASE.jar;F:apache-maven-3.6.0
    epository
    edisclientsjedis3.3.0jedis-3.3.0.jar;F:apache-maven-3.6.0
    epositoryorgapachecommonscommons-pool22.8.0commons-pool2-2.8.0.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkootspring-boot-starter-test2.3.1.RELEASEspring-boot-starter-test-2.3.1.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkootspring-boot-test2.3.1.RELEASEspring-boot-test-2.3.1.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkootspring-boot-test-autoconfigure2.3.1.RELEASEspring-boot-test-autoconfigure-2.3.1.RELEASE.jar;F:apache-maven-3.6.0
    epositorycomjaywayjsonpathjson-path2.4.0json-path-2.4.0.jar;F:apache-maven-3.6.0
    epository
    etminidevjson-smart2.3json-smart-2.3.jar;F:apache-maven-3.6.0
    epository
    etminidevaccessors-smart1.2accessors-smart-1.2.jar;F:apache-maven-3.6.0
    epositoryorgow2asmasm5.0.4asm-5.0.4.jar;F:apache-maven-3.6.0
    epositoryjakartaxmlindjakarta.xml.bind-api2.3.3jakarta.xml.bind-api-2.3.3.jar;F:apache-maven-3.6.0
    epositoryjakartaactivationjakarta.activation-api1.2.2jakarta.activation-api-1.2.2.jar;F:apache-maven-3.6.0
    epositoryorgassertjassertj-core3.16.1assertj-core-3.16.1.jar;F:apache-maven-3.6.0
    epositoryorghamcresthamcrest2.2hamcrest-2.2.jar;F:apache-maven-3.6.0
    epositoryorgjunitjupiterjunit-jupiter5.6.2junit-jupiter-5.6.2.jar;F:apache-maven-3.6.0
    epositoryorgjunitjupiterjunit-jupiter-api5.6.2junit-jupiter-api-5.6.2.jar;F:apache-maven-3.6.0
    epositoryorgopentest4jopentest4j1.2.0opentest4j-1.2.0.jar;F:apache-maven-3.6.0
    epositoryorgjunitplatformjunit-platform-commons1.6.2junit-platform-commons-1.6.2.jar;F:apache-maven-3.6.0
    epositoryorgjunitjupiterjunit-jupiter-params5.6.2junit-jupiter-params-5.6.2.jar;F:apache-maven-3.6.0
    epositoryorgjunitjupiterjunit-jupiter-engine5.6.2junit-jupiter-engine-5.6.2.jar;F:apache-maven-3.6.0
    epositoryorgjunitvintagejunit-vintage-engine5.6.2junit-vintage-engine-5.6.2.jar;F:apache-maven-3.6.0
    epositoryorgapiguardianapiguardian-api1.1.0apiguardian-api-1.1.0.jar;F:apache-maven-3.6.0
    epositoryorgjunitplatformjunit-platform-engine1.6.2junit-platform-engine-1.6.2.jar;F:apache-maven-3.6.0
    epositoryjunitjunit4.13junit-4.13.jar;F:apache-maven-3.6.0
    epositoryorgmockitomockito-core3.3.3mockito-core-3.3.3.jar;F:apache-maven-3.6.0
    epository
    etytebuddyyte-buddy-agent1.10.11yte-buddy-agent-1.10.11.jar;F:apache-maven-3.6.0
    epositoryorgobjenesisobjenesis2.6objenesis-2.6.jar;F:apache-maven-3.6.0
    epositoryorgmockitomockito-junit-jupiter3.3.3mockito-junit-jupiter-3.3.3.jar;F:apache-maven-3.6.0
    epositoryorgskyscreamerjsonassert1.5.0jsonassert-1.5.0.jar;F:apache-maven-3.6.0
    epositorycomvaadinexternalgoogleandroid-json.0.20131108.vaadin1android-json-0.0.20131108.vaadin1.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkspring-core5.2.7.RELEASEspring-core-5.2.7.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkspring-jcl5.2.7.RELEASEspring-jcl-5.2.7.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgspringframeworkspring-test5.2.7.RELEASEspring-test-5.2.7.RELEASE.jar;F:apache-maven-3.6.0
    epositoryorgxmlunitxmlunit-core2.7.0xmlunit-core-2.7.0.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 com.example.test.Test,test
    23:40:22.379 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class com.example.test.Test]
    23:40:22.390 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
    23:40:22.413 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
    23:40:22.538 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.example.test.Test] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
    23:40:22.590 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.example.test.Test], using SpringBootContextLoader
    23:40:22.614 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.example.test.Test]: class path resource [com/example/test/Test-context.xml] does not exist
    23:40:22.620 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.example.test.Test]: class path resource [com/example/test/TestContext.groovy] does not exist
    23:40:22.621 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.example.test.Test]: no resource found for suffixes {-context.xml, Context.groovy}.
    23:40:22.747 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.example.test.Test]
    23:40:23.280 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [com.example.test.Test]: using defaults.
    23:40:23.281 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]
    23:40:23.405 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@6b0d80ed, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@6f8e8894, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@3cfdd820, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@928763c, org.springframework.test.context.support.DirtiesContextTestExecutionListener@e25951c, org.springframework.test.context.transaction.TransactionalTestExecutionListener@15f47664, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@471a9022, org.springframework.test.context.event.EventPublishingTestExecutionListener@dc9876b, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@2f666ebb, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@19976a65, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@a1f72f5, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@4b2c5e02, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@57a3e26a, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener@75c56eb9]
    23:40:23.410 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.example.test.Test]
    23:40:23.424 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.example.test.Test]
    23:40:23.455 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.example.test.Test]
    23:40:23.459 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.example.test.Test]
    23:40:23.460 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.example.test.Test]
    23:40:23.460 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.example.test.Test]23:40:23.531 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.example.test.Test]
    23:40:23.532 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.example.test.Test]23:40:23.534 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.example.test.Test]
    23:40:23.535 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.example.test.Test]
    23:40:23.573 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.example.test.Test]
    23:40:23.574 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.example.test.Test]
    23:40:23.609 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@12299890 testClass = Test, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@2fba3fc4 testClass = Test, locations = '{}', classes = '{class com.CleanSpringBootApplication, class com.CleanSpringBootApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@75db5df9, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@6a2f6f80, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@6ab778a, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@68567e20, org.springframework.boot.test.context.SpringBootTestArgs@1], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true]], class annotated with @DirtiesContext [false] with mode [null].
    23:40:23.616 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.example.test.Test]
    23:40:23.617 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.example.test.Test]
    23:40:23.808 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}
    
      .   ____          _            __ _ _
     /\ / ___'_ __ _ _(_)_ __  __ _    
    ( ( )\___ | '_ | '_| | '_ / _` |    
     \/  ___)| |_)| | | | | || (_| |  ) ) ) )
      '  |____| .__|_| |_|_| |_\__, | / / / /
     =========|_|==============|___/=/_/_/_/
     :: Spring Boot ::        (v2.3.1.RELEASE)
    
    2020-07-18 23:40:26.089  INFO 15108 --- [           main] com.example.test.Test                    : Starting Test on DESKTOP-2PVNKVI with PID 15108 (started by Administrator in D:学习代码javacleanSpringBoot)
    2020-07-18 23:40:26.092  INFO 15108 --- [           main] com.example.test.Test                    : No active profile set, falling back to default profiles: default
    2020-07-18 23:40:35.180  INFO 15108 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
    2020-07-18 23:40:35.185  INFO 15108 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
    2020-07-18 23:40:37.352  INFO 15108 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 2141ms. Found 1 JPA repository interfaces.
    2020-07-18 23:40:37.398  INFO 15108 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
    2020-07-18 23:40:37.402  INFO 15108 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode.
    2020-07-18 23:40:38.983  INFO 15108 --- [           main] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.example.dao.IUserDao. If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository.
    2020-07-18 23:40:38.983  INFO 15108 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 1558ms. Found 0 Redis repository interfaces.
    Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
    2020-07-18 23:40:41.686  INFO 15108 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
    2020-07-18 23:40:42.900  INFO 15108 --- [         task-1] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
    2020-07-18 23:40:43.307  INFO 15108 --- [         task-1] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.4.17.Final
    2020-07-18 23:40:44.358  INFO 15108 --- [         task-1] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
    2020-07-18 23:40:44.940  WARN 15108 --- [           main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
    2020-07-18 23:40:48.749  INFO 15108 --- [         task-1] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
    2020-07-18 23:40:48.824  WARN 15108 --- [         task-1] com.zaxxer.hikari.util.DriverDataSource  : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
    2020-07-18 23:40:50.562  INFO 15108 --- [           main] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositories…
    2020-07-18 23:40:52.035  INFO 15108 --- [         task-1] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
    2020-07-18 23:40:52.091  INFO 15108 --- [         task-1] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
    2020-07-18 23:40:54.809  INFO 15108 --- [         task-1] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
    2020-07-18 23:40:54.827  INFO 15108 --- [         task-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
    2020-07-18 23:40:55.227  INFO 15108 --- [           main] DeferredRepositoryInitializationListener : Spring Data repositories initialized!
    2020-07-18 23:40:55.256  INFO 15108 --- [           main] com.example.test.Test                    : Started Test in 31.333 seconds (JVM running for 35.175)
    [User{id=1, username='zhangsan', password='123456', name='张三'}, User{id=2, username='lisi', password='123456', name='李四'}, User{id=3, username='wangwu', password='123456', name='王五'}, User{id=4, username='zhangwei', password='123456', name='张伟'}, User{id=5, username='lina', password='123456', name='李娜'}, User{id=6, username='lilei', password='123456', name='李磊'}]
    2020-07-18 23:40:55.928  INFO 15108 --- [extShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
    2020-07-18 23:40:55.934  INFO 15108 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
    2020-07-18 23:40:55.936  INFO 15108 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
    2020-07-18 23:40:55.978  INFO 15108 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
    
    Process finished with exit code 0
  • 相关阅读:
    linux tcpdump(转)
    linux ping
    Dalvik VM和JVM 的比较
    Android应用开发基础之八:广播与服务(二)
    Android应用开发基础之七:广播与服务(一)
    Android应用开发基础之五:网络编程(二)
    Android应用开发基础之三:数据存储和界面展现(三)
    Android应用开发基础之二:数据存储和界面展现(二)
    Android应用开发基础之一:数据存储和界面展现(一)
    Android之Fragment 基本介绍(转)
  • 原文地址:https://www.cnblogs.com/luzhanshi/p/13338209.html
Copyright © 2020-2023  润新知