SpringBoot工程启动报错

SpringBoot工程启动报错_第1张图片
SpringBoot启动报错

"D:\Program Files\Java\jdk1.8.0_152\bin\java.exe" -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:D:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.2\lib\idea_rt.jar=13847:D:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.2\bin" -Dfile.encoding=UTF-8 -classpath "D:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.2\lib\idea_rt.jar;D:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.2\plugins\junit\lib\junit-rt.jar;D:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.2\plugins\junit\lib\junit5-rt.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\charsets.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\deploy.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\access-bridge-64.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\cldrdata.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\dnsns.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\jaccess.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\jfxrt.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\localedata.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\nashorn.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\sunec.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\sunjce_provider.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\sunmscapi.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\sunpkcs11.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\ext\zipfs.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\javaws.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\jce.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\jfr.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\jfxswt.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\jsse.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\management-agent.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\plugin.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\resources.jar;D:\Program Files\Java\jdk1.8.0_152\jre\lib\rt.jar;D:\IDE\source\mongodb\task\target\test-classes;D:\IDE\source\mongodb\task\target\classes;D:\apache-maven-3.1.1\repository\org\springframework\boot\spring-boot-starter-data-mongodb\1.5.0.RELEASE\spring-boot-starter-data-mongodb-1.5.0.RELEASE.jar;D:\apache-maven-3.1.1\repository\org\springframework\boot\spring-boot-starter\1.5.0.RELEASE\spring-boot-starter-1.5.0.RELEASE.jar;D:\apache-maven-3.1.1\repository\org\springframework\boot\spring-boot\1.5.0.RELEASE\spring-boot-1.5.0.RELEASE.jar;D:\apache-maven-3.1.1\repository\org\springframework\boot\spring-boot-autoconfigure\1.5.0.RELEASE\spring-boot-autoconfigure-1.5.0.RELEASE.jar;D:\apache-maven-3.1.1\repository\org\springframework\boot\spring-boot-starter-logging\1.5.0.RELEASE\spring-boot-starter-logging-1.5.0.RELEASE.jar;D:\apache-maven-3.1.1\repository\ch\qos\logback\logback-classic\1.1.9\logback-classic-1.1.9.jar;D:\apache-maven-3.1.1\repository\ch\qos\logback\logback-core\1.1.9\logback-core-1.1.9.jar;D:\apache-maven-3.1.1\repository\org\slf4j\jul-to-slf4j\1.7.22\jul-to-slf4j-1.7.22.jar;D:\apache-maven-3.1.1\repository\org\slf4j\log4j-over-slf4j\1.7.22\log4j-over-slf4j-1.7.22.jar;D:\apache-maven-3.1.1\repository\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;D:\apache-maven-3.1.1\repository\org\mongodb\mongodb-driver\3.4.1\mongodb-driver-3.4.1.jar;D:\apache-maven-3.1.1\repository\org\mongodb\mongodb-driver-core\3.4.1\mongodb-driver-core-3.4.1.jar;D:\apache-maven-3.1.1\repository\org\mongodb\bson\3.4.1\bson-3.4.1.jar;D:\apache-maven-3.1.1\repository\org\springframework\data\spring-data-mongodb\1.10.0.RELEASE\spring-data-mongodb-1.10.0.RELEASE.jar;D:\apache-maven-3.1.1\repository\org\springframework\spring-tx\4.3.6.RELEASE\spring-tx-4.3.6.RELEASE.jar;D:\apache-maven-3.1.1\repository\org\springframework\spring-context\4.3.6.RELEASE\spring-context-4.3.6.RELEASE.jar;D:\apache-maven-3.1.1\repository\org\springframework\spring-aop\4.3.6.RELEASE\spring-aop-4.3.6.RELEASE.jar;D:\apache-maven-3.1.1\repository\org\springframework\spring-beans\4.3.6.RELEASE\spring-beans-4.3.6.RELEASE.jar;D:\apache-maven-3.1.1\repository\org\springframework\spring-expression\4.3.6.RELEASE\spring-expression-4.3.6.RELEASE.jar;D:\apache-maven-3.1.1\repository\org\springframework\data\spring-data-commons\1.13.0.RELEASE\spring-data-commons-1.13.0.RELEASE.jar;D:\apache-maven-3.1.1\repository\org\slf4j\slf4j-api\1.7.22\slf4j-api-1.7.22.jar;D:\apache-maven-3.1.1\repository\org\slf4j\jcl-over-slf4j\1.7.22\jcl-over-slf4j-1.7.22.jar;D:\apache-maven-3.1.1\repository\org\springframework\boot\spring-boot-starter-test\1.5.0.RELEASE\spring-boot-starter-test-1.5.0.RELEASE.jar;D:\apache-maven-3.1.1\repository\org\springframework\boot\spring-boot-test\1.5.0.RELEASE\spring-boot-test-1.5.0.RELEASE.jar;D:\apache-maven-3.1.1\repository\org\springframework\boot\spring-boot-test-autoconfigure\1.5.0.RELEASE\spring-boot-test-autoconfigure-1.5.0.RELEASE.jar;D:\apache-maven-3.1.1\repository\com\jayway\jsonpath\json-path\2.2.0\json-path-2.2.0.jar;D:\apache-maven-3.1.1\repository\net\minidev\json-smart\2.2.1\json-smart-2.2.1.jar;D:\apache-maven-3.1.1\repository\net\minidev\accessors-smart\1.1\accessors-smart-1.1.jar;D:\apache-maven-3.1.1\repository\org\ow2\asm\asm\5.0.3\asm-5.0.3.jar;D:\apache-maven-3.1.1\repository\junit\junit\4.12\junit-4.12.jar;D:\apache-maven-3.1.1\repository\org\assertj\assertj-core\2.6.0\assertj-core-2.6.0.jar;D:\apache-maven-3.1.1\repository\org\mockito\mockito-core\1.10.19\mockito-core-1.10.19.jar;D:\apache-maven-3.1.1\repository\org\objenesis\objenesis\2.1\objenesis-2.1.jar;D:\apache-maven-3.1.1\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;D:\apache-maven-3.1.1\repository\org\hamcrest\hamcrest-library\1.3\hamcrest-library-1.3.jar;D:\apache-maven-3.1.1\repository\org\skyscreamer\jsonassert\1.4.0\jsonassert-1.4.0.jar;D:\apache-maven-3.1.1\repository\com\vaadin\external\google\android-json\0.0.20131108.vaadin1\android-json-0.0.20131108.vaadin1.jar;D:\apache-maven-3.1.1\repository\org\springframework\spring-core\4.3.6.RELEASE\spring-core-4.3.6.RELEASE.jar;D:\apache-maven-3.1.1\repository\org\springframework\spring-test\4.3.6.RELEASE\spring-test-4.3.6.RELEASE.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 cn.com.zuobin.MongoTest,testFindList
20:29:23.052 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class cn.com.zuobin.MongoTest]
20:29:23.064 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
20:29:23.086 [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)]
20:29:23.124 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [cn.com.zuobin.MongoTest] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
20:29:23.158 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [cn.com.zuobin.MongoTest], using SpringBootContextLoader
20:29:23.165 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [cn.com.zuobin.MongoTest]: class path resource [cn/com/zuobin/MongoTest-context.xml] does not exist
20:29:23.165 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [cn.com.zuobin.MongoTest]: class path resource [cn/com/zuobin/MongoTestContext.groovy] does not exist
20:29:23.166 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [cn.com.zuobin.MongoTest]: no resource found for suffixes {-context.xml, Context.groovy}.
20:29:23.167 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [cn.com.zuobin.MongoTest]: MongoTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
20:29:23.246 [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 [cn.com.zuobin.MongoTest]
20:29:23.264 [main] DEBUG org.springframework.core.env.StandardEnvironment - Adding [systemProperties] PropertySource with lowest search precedence
20:29:23.266 [main] DEBUG org.springframework.core.env.StandardEnvironment - Adding [systemEnvironment] PropertySource with lowest search precedence
20:29:23.267 [main] DEBUG org.springframework.core.env.StandardEnvironment - Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]
20:29:23.294 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Resolved classpath location [cn/com/zuobin/] to resources [URL [file:/D:/IDE/source/mongodb/task/target/test-classes/cn/com/zuobin/]]
20:29:23.295 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Looking for matching resources in directory tree [D:\IDE\source\mongodb\task\target\test-classes\cn\com\zuobin]
20:29:23.295 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Searching directory [D:\IDE\source\mongodb\task\target\test-classes\cn\com\zuobin] for files matching pattern [D:/IDE/source/mongodb/task/target/test-classes/cn/com/zuobin/*.class]
20:29:23.300 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Resolved location pattern [classpath*:cn/com/zuobin/*.class] to resources [file [D:\IDE\source\mongodb\task\target\test-classes\cn\com\zuobin\MongoTest.class]]
20:29:23.330 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Resolved classpath location [cn/com/] to resources [URL [file:/D:/IDE/source/mongodb/task/target/test-classes/cn/com/]]
20:29:23.330 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Looking for matching resources in directory tree [D:\IDE\source\mongodb\task\target\test-classes\cn\com]
20:29:23.330 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Searching directory [D:\IDE\source\mongodb\task\target\test-classes\cn\com] for files matching pattern [D:/IDE/source/mongodb/task/target/test-classes/cn/com/*.class]
20:29:23.331 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Resolved location pattern [classpath*:cn/com/*.class] to resources []
20:29:23.333 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Resolved classpath location [cn/] to resources [URL [file:/D:/IDE/source/mongodb/task/target/test-classes/cn/]]
20:29:23.333 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Looking for matching resources in directory tree [D:\IDE\source\mongodb\task\target\test-classes\cn]
20:29:23.333 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Searching directory [D:\IDE\source\mongodb\task\target\test-classes\cn] for files matching pattern [D:/IDE/source/mongodb/task/target/test-classes/cn/*.class]
20:29:23.334 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Resolved location pattern [classpath*:cn/*.class] to resources []
java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test

    at org.springframework.util.Assert.state(Assert.java:392)
    at org.springframework.boot.test.context.SpringBootTestContextBootstrapper.getOrFindConfigurationClasses(SpringBootTestContextBootstrapper.java:173)
    at org.springframework.boot.test.context.SpringBootTestContextBootstrapper.processMergedContextConfiguration(SpringBootTestContextBootstrapper.java:133)
    at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:409)
    at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildDefaultMergedContextConfiguration(AbstractTestContextBootstrapper.java:323)
    at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildMergedContextConfiguration(AbstractTestContextBootstrapper.java:277)
    at org.springframework.test.context.support.AbstractTestContextBootstrapper.buildTestContext(AbstractTestContextBootstrapper.java:112)
    at org.springframework.boot.test.context.SpringBootTestContextBootstrapper.buildTestContext(SpringBootTestContextBootstrapper.java:78)
    at org.springframework.test.context.TestContextManager.(TestContextManager.java:120)
    at org.springframework.test.context.TestContextManager.(TestContextManager.java:105)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTestContextManager(SpringJUnit4ClassRunner.java:152)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.(SpringJUnit4ClassRunner.java:143)
    at org.springframework.test.context.junit4.SpringRunner.(SpringRunner.java:49)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
    at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
    at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:36)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:49)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)


Process finished with exit code -1

出现上述原因,是因为没有Application这个类,需要进行配置
SpringBoot工程启动报错_第2张图片

你可能感兴趣的:(SpringBoot工程启动报错)