在学校数据源的时候,还没有开始使用数据源,项目就关闭了。
为了学习数据源,就只能使用测试类。
但是,最近需要使用restful进行测试的时候,项目是关闭的,就很糟糕,不好进行测试。
1.日志如下:
1 D:jdk1.8.0_144injava -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:47661,suspend=y,server=n -Dfile.encoding=UTF-8 -classpath "D:jdk1.8.0_144jrelibcharsets.jar;D:jdk1.8.0_144jrelibdeploy.jar;D:jdk1.8.0_144jrelibextaccess-bridge-64.jar;D:jdk1.8.0_144jrelibextcldrdata.jar;D:jdk1.8.0_144jrelibextdnsns.jar;D:jdk1.8.0_144jrelibextjaccess.jar;D:jdk1.8.0_144jrelibextjfxrt.jar;D:jdk1.8.0_144jrelibextlocaledata.jar;D:jdk1.8.0_144jrelibext ashorn.jar;D:jdk1.8.0_144jrelibextsunec.jar;D:jdk1.8.0_144jrelibextsunjce_provider.jar;D:jdk1.8.0_144jrelibextsunmscapi.jar;D:jdk1.8.0_144jrelibextsunpkcs11.jar;D:jdk1.8.0_144jrelibextzipfs.jar;D:jdk1.8.0_144jrelibjavaws.jar;D:jdk1.8.0_144jrelibjce.jar;D:jdk1.8.0_144jrelibjfr.jar;D:jdk1.8.0_144jrelibjfxswt.jar;D:jdk1.8.0_144jrelibjsse.jar;D:jdk1.8.0_144jrelibmanagement-agent.jar;D:jdk1.8.0_144jrelibplugin.jar;D:jdk1.8.0_144jrelib esources.jar;D:jdk1.8.0_144jrelib t.jar;E:IDEA_TestIDEA_springBoot argetclasses;C:Usersdell.m2 epositoryorgspringframeworkootspring-boot-starter-aop2.0.6.RELEASEspring-boot-starter-aop-2.0.6.RELEASE.jar;C:Usersdell.m2 epositoryorgspringframeworkootspring-boot-starter2.0.6.RELEASEspring-boot-starter-2.0.6.RELEASE.jar;C:Usersdell.m2 epositoryorgspringframeworkootspring-boot-autoconfigure2.0.6.RELEASEspring-boot-autoconfigure-2.0.6.RELEASE.jar;C:Usersdell.m2 epositoryorgspringframeworkootspring-boot-starter-logging2.0.6.RELEASEspring-boot-starter-logging-2.0.6.RELEASE.jar;C:Usersdell.m2 epositorychqoslogbacklogback-classic1.2.3logback-classic-1.2.3.jar;C:Usersdell.m2 epositorychqoslogbacklogback-core1.2.3logback-core-1.2.3.jar;C:Usersdell.m2 epositoryorgapachelogginglog4jlog4j-to-slf4j2.10.0log4j-to-slf4j-2.10.0.jar;C:Usersdell.m2 epositoryorgapachelogginglog4jlog4j-api2.10.0log4j-api-2.10.0.jar;C:Usersdell.m2 epositoryorgslf4jjul-to-slf4j1.7.25jul-to-slf4j-1.7.25.jar;C:Usersdell.m2 epositoryorgspringframeworkspring-aop5.0.10.RELEASEspring-aop-5.0.10.RELEASE.jar;C:Usersdell.m2 epositoryorgspringframeworkspring-beans5.0.10.RELEASEspring-beans-5.0.10.RELEASE.jar;C:Usersdell.m2 epositoryorgaspectjaspectjweaver1.8.13aspectjweaver-1.8.13.jar;C:Usersdell.m2 epositoryorgspringframeworkootspring-boot-starter-web2.0.6.RELEASEspring-boot-starter-web-2.0.6.RELEASE.jar;C:Usersdell.m2 epositoryorgspringframeworkootspring-boot-starter-json2.0.6.RELEASEspring-boot-starter-json-2.0.6.RELEASE.jar;C:Usersdell.m2 epositorycomfasterxmljacksoncorejackson-databind2.9.7jackson-databind-2.9.7.jar;C:Usersdell.m2 epositorycomfasterxmljacksoncorejackson-annotations2.9.0jackson-annotations-2.9.0.jar;C:Usersdell.m2 epositorycomfasterxmljacksoncorejackson-core2.9.7jackson-core-2.9.7.jar;C:Usersdell.m2 epositorycomfasterxmljacksondatatypejackson-datatype-jdk82.9.7jackson-datatype-jdk8-2.9.7.jar;C:Usersdell.m2 epositorycomfasterxmljacksondatatypejackson-datatype-jsr3102.9.7jackson-datatype-jsr310-2.9.7.jar;C:Usersdell.m2 epositorycomfasterxmljacksonmodulejackson-module-parameter-names2.9.7jackson-module-parameter-names-2.9.7.jar;C:Usersdell.m2 epositoryorghibernatevalidatorhibernate-validator6.0.13.Finalhibernate-validator-6.0.13.Final.jar;C:Usersdell.m2 epositoryjavaxvalidationvalidation-api2.0.1.Finalvalidation-api-2.0.1.Final.jar;C:Usersdell.m2 epositoryorgjbossloggingjboss-logging3.3.2.Finaljboss-logging-3.3.2.Final.jar;C:Usersdell.m2 epositorycomfasterxmlclassmate1.3.4classmate-1.3.4.jar;C:Usersdell.m2 epositoryorgspringframeworkspring-web5.0.10.RELEASEspring-web-5.0.10.RELEASE.jar;C:Usersdell.m2 epositoryorgspringframeworkspring-webmvc5.0.10.RELEASEspring-webmvc-5.0.10.RELEASE.jar;C:Usersdell.m2 epositoryorgspringframeworkspring-context5.0.10.RELEASEspring-context-5.0.10.RELEASE.jar;C:Usersdell.m2 epositoryorgspringframeworkspring-expression5.0.10.RELEASEspring-expression-5.0.10.RELEASE.jar;C:Usersdell.m2 epositorymysqlmysql-connector-java5.1.47mysql-connector-java-5.1.47.jar;C:Usersdell.m2 epositoryorgspringframeworkootspring-boot-starter-jdbc2.0.6.RELEASEspring-boot-starter-jdbc-2.0.6.RELEASE.jar;C:Usersdell.m2 epositoryorgspringframeworkspring-jdbc5.0.10.RELEASEspring-jdbc-5.0.10.RELEASE.jar;C:Usersdell.m2 epositoryorgspringframeworkspring-tx5.0.10.RELEASEspring-tx-5.0.10.RELEASE.jar;C:Usersdell.m2 epositoryorgspringframeworkootspring-boot-starter-data-jpa2.0.6.RELEASEspring-boot-starter-data-jpa-2.0.6.RELEASE.jar;C:Usersdell.m2 epositoryjavax ransactionjavax.transaction-api1.2javax.transaction-api-1.2.jar;C:Usersdell.m2 epositoryorghibernatehibernate-core5.2.17.Finalhibernate-core-5.2.17.Final.jar;C:Usersdell.m2 epositoryorghibernatejavaxpersistencehibernate-jpa-2.1-api1.0.2.Finalhibernate-jpa-2.1-api-1.0.2.Final.jar;C:Usersdell.m2 epositoryorgjavassistjavassist3.22.0-GAjavassist-3.22.0-GA.jar;C:Usersdell.m2 epositoryantlrantlr2.7.7antlr-2.7.7.jar;C:Usersdell.m2 epositoryorgjbossjandex2.0.3.Finaljandex-2.0.3.Final.jar;C:Usersdell.m2 epositorydom4jdom4j1.6.1dom4j-1.6.1.jar;C:Usersdell.m2 epositoryorghibernatecommonhibernate-commons-annotations5.0.1.Finalhibernate-commons-annotations-5.0.1.Final.jar;C:Usersdell.m2 epositoryorgspringframeworkdataspring-data-jpa2.0.11.RELEASEspring-data-jpa-2.0.11.RELEASE.jar;C:Usersdell.m2 epositoryorgspringframeworkdataspring-data-commons2.0.11.RELEASEspring-data-commons-2.0.11.RELEASE.jar;C:Usersdell.m2 epositoryorgspringframeworkspring-orm5.0.10.RELEASEspring-orm-5.0.10.RELEASE.jar;C:Usersdell.m2 epositoryorgspringframeworkspring-aspects5.0.10.RELEASEspring-aspects-5.0.10.RELEASE.jar;C:Usersdell.m2 epositoryorgapache omcat omcat-jdbc8.5.34 omcat-jdbc-8.5.34.jar;C:Usersdell.m2 epositoryorgapache omcat omcat-juli8.5.34 omcat-juli-8.5.34.jar;C:Usersdell.m2 epositorycomzaxxerHikariCP2.7.9HikariCP-2.7.9.jar;C:Usersdell.m2 epositoryorgslf4jslf4j-api1.7.25slf4j-api-1.7.25.jar;C:Usersdell.m2 epositoryorgapachecommonscommons-dbcp22.2.0commons-dbcp2-2.2.0.jar;C:Usersdell.m2 epositoryorgapachecommonscommons-pool22.5.0commons-pool2-2.5.0.jar;C:Usersdell.m2 epositoryjavaxannotationjavax.annotation-api1.3.2javax.annotation-api-1.3.2.jar;C:Usersdell.m2 epositoryorgspringframeworkootspring-boot-starter-test2.0.6.RELEASEspring-boot-starter-test-2.0.6.RELEASE.jar;C:Usersdell.m2 epositoryorgspringframeworkootspring-boot-test-autoconfigure2.0.6.RELEASEspring-boot-test-autoconfigure-2.0.6.RELEASE.jar;C:Usersdell.m2 epositorycomjaywayjsonpathjson-path2.4.0json-path-2.4.0.jar;C:Usersdell.m2 epository etminidevjson-smart2.3json-smart-2.3.jar;C:Usersdell.m2 epository etminidevaccessors-smart1.2accessors-smart-1.2.jar;C:Usersdell.m2 epositoryorgow2asmasm5.0.4asm-5.0.4.jar;C:Usersdell.m2 epositoryjunitjunit4.12junit-4.12.jar;C:Usersdell.m2 epositoryorgassertjassertj-core3.9.1assertj-core-3.9.1.jar;C:Usersdell.m2 epositoryorgmockitomockito-core2.15.0mockito-core-2.15.0.jar;C:Usersdell.m2 epository etytebuddyyte-buddy1.7.11yte-buddy-1.7.11.jar;C:Usersdell.m2 epository etytebuddyyte-buddy-agent1.7.11yte-buddy-agent-1.7.11.jar;C:Usersdell.m2 epositoryorgobjenesisobjenesis2.6objenesis-2.6.jar;C:Usersdell.m2 epositoryorghamcresthamcrest-core1.3hamcrest-core-1.3.jar;C:Usersdell.m2 epositoryorghamcresthamcrest-library1.3hamcrest-library-1.3.jar;C:Usersdell.m2 epositoryorgskyscreamerjsonassert1.5.0jsonassert-1.5.0.jar;C:Usersdell.m2 epositorycomvaadinexternalgoogleandroid-json .0.20131108.vaadin1android-json-0.0.20131108.vaadin1.jar;C:Usersdell.m2 epositoryorgspringframeworkspring-core5.0.10.RELEASEspring-core-5.0.10.RELEASE.jar;C:Usersdell.m2 epositoryorgspringframeworkspring-jcl5.0.10.RELEASEspring-jcl-5.0.10.RELEASE.jar;C:Usersdell.m2 epositoryorgspringframeworkspring-test5.0.10.RELEASEspring-test-5.0.10.RELEASE.jar;C:Usersdell.m2 epositoryorgxmlunitxmlunit-core2.5.1xmlunit-core-2.5.1.jar;C:Usersdell.m2 epositoryorgspringframeworkootspring-boot-configuration-processor2.0.6.RELEASEspring-boot-configuration-processor-2.0.6.RELEASE.jar;C:Usersdell.m2 epositoryorgyamlsnakeyaml1.23snakeyaml-1.23.jar;C:Usersdell.m2 epositoryorgspringframeworkootspring-boot-test2.0.6.RELEASEspring-boot-test-2.0.6.RELEASE.jar;C:Usersdell.m2 epositoryorgspringframeworkootspring-boot2.0.6.RELEASEspring-boot-2.0.6.RELEASE.jar;C:Usersdell.m2 epositoryorgmybatisspringootmybatis-spring-boot-starter1.3.1mybatis-spring-boot-starter-1.3.1.jar;C:Usersdell.m2 epositoryorgmybatisspringootmybatis-spring-boot-autoconfigure1.3.1mybatis-spring-boot-autoconfigure-1.3.1.jar;C:Usersdell.m2 epositoryorgmybatismybatis3.4.5mybatis-3.4.5.jar;C:Usersdell.m2 epositoryorgmybatismybatis-spring1.3.1mybatis-spring-1.3.1.jar;D:IntelliJ IDEA 2017.2libidea_rt.jar" com.springBoot.springbootAndMybatis.ApplicationTest.Application 2 Connected to the target VM, address: '127.0.0.1:47661', transport: 'socket' 3 4 . ____ _ __ _ _ 5 /\ / ___'_ __ _ _(_)_ __ __ _ 6 ( ( )\___ | '_ | '_| | '_ / _` | 7 \/ ___)| |_)| | | | | || (_| | ) ) ) ) 8 ' |____| .__|_| |_|_| |_\__, | / / / / 9 =========|_|==============|___/=/_/_/_/ 10 :: Spring Boot :: (v2.0.6.RELEASE) 11 12 2018-12-05 22:04:03.377 INFO 2360 --- [ main] c.s.s.ApplicationTest.Application : Starting Application on DESKTOP-TQ4OD79 with PID 2360 (E:IDEA_TestIDEA_springBoot argetclasses started by dell in E:IDEA_TestIDEA_springBoot) 13 2018-12-05 22:04:03.383 INFO 2360 --- [ main] c.s.s.ApplicationTest.Application : The following profiles are active: dev 14 2018-12-05 22:04:03.452 INFO 2360 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@353352b6: startup date [Wed Dec 05 22:04:03 CST 2018]; root of context hierarchy 15 2018-12-05 22:04:04.170 WARN 2360 --- [ main] o.m.s.mapper.ClassPathMapperScanner : No MyBatis mapper was found in '[com.springBoot.springbootAndMybatis.ApplicationTest]' package. Please check your configuration. 16 2018-12-05 22:04:04.930 INFO 2360 --- [ main] com.zaxxer.hikari.HikariDataSource : DatebookHikariCP - Starting... 17 2018-12-05 22:04:05.186 INFO 2360 --- [ main] com.zaxxer.hikari.HikariDataSource : DatebookHikariCP - Start completed. 18 2018-12-05 22:04:05.244 INFO 2360 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default' 19 2018-12-05 22:04:05.271 INFO 2360 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [ 20 name: default 21 ...] 22 2018-12-05 22:04:05.373 INFO 2360 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.2.17.Final} 23 2018-12-05 22:04:05.375 INFO 2360 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found 24 2018-12-05 22:04:05.431 INFO 2360 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 25 2018-12-05 22:04:05.606 INFO 2360 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect 26 2018-12-05 22:04:06.285 INFO 2360 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 27 2018-12-05 22:04:06.971 INFO 2360 --- [ main] c.s.s.ApplicationTest.Application : Started Application in 4.077 seconds (JVM running for 4.994) 28 2018-12-05 22:04:06.974 INFO 2360 --- [ Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@353352b6: startup date [Wed Dec 05 22:04:03 CST 2018]; root of context hierarchy 29 2018-12-05 22:04:06.976 INFO 2360 --- [ Thread-2] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 30 2018-12-05 22:04:06.977 INFO 2360 --- [ Thread-2] com.zaxxer.hikari.HikariDataSource : DatebookHikariCP - Shutdown initiated... 31 Disconnected from the target VM, address: '127.0.0.1:47661', transport: 'socket' 32 2018-12-05 22:04:06.995 INFO 2360 --- [ Thread-2] com.zaxxer.hikari.HikariDataSource : DatebookHikariCP - Shutdown completed. 33 34 Process finished with exit code 0
2.解决 方式
后来百度了,不外乎是两种方式。
一种加入spring-boot-starter-web依赖,但是这个我在创建springboot项目的时候就存在了。
然后,还有一种说法,我实验了一下是可以的。
将provided去掉: