IDEA中出现DEBUG报错请问怎么解决

在IDEA中Spring Boot 遇到写报错请问怎么解决


14:52:17.506 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
14:52:17.522 [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)]
14:52:17.558 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.boot.SbootZxgwptApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
14:52:17.569 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.boot.SbootZxgwptApplicationTests], using SpringBootContextLoader
14:52:17.574 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.boot.SbootZxgwptApplicationTests]: class path resource [com/boot/SbootZxgwptApplicationTests-context.xml] does not exist
14:52:17.574 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.boot.SbootZxgwptApplicationTests]: class path resource [com/boot/SbootZxgwptApplicationTestsContext.groovy] does not exist
14:52:17.574 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.boot.SbootZxgwptApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.
14:52:17.575 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [com.boot.SbootZxgwptApplicationTests]: SbootZxgwptApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
14:52:17.621 [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.boot.SbootZxgwptApplicationTests]
14:52:17.685 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [D:\code\graphics\target\classes\com\boot\SpringBootApplicationStarter.class]
14:52:17.687 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration com.boot.SpringBootApplicationStarter for test class com.boot.SbootZxgwptApplicationTests
14:52:17.802 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [com.boot.SbootZxgwptApplicationTests]: using defaults.
14:52:17.802 [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.event.ApplicationEventsTestExecutionListener, 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]
14:52:17.820 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@29a5f4e7, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@79c97cb, org.springframework.test.context.event.ApplicationEventsTestExecutionListener@2d9caaeb, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@42a15bdc, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@44a59da3, org.springframework.test.context.support.DirtiesContextTestExecutionListener@27e47833, org.springframework.test.context.transaction.TransactionalTestExecutionListener@6f6745d6, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@27508c5d, org.springframework.test.context.event.EventPublishingTestExecutionListener@4f704591, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@4b5189ac, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@1e4d3ce5, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@3ddc6915, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@704deff2, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@379614be, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener@404bbcbd]
14:52:17.824 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@68034211 testClass = SbootZxgwptApplicationTests, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@4f74980d testClass = SbootZxgwptApplicationTests, locations = '{}', classes = '{class com.boot.SpringBootApplicationStarter}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@158a8276, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@5fbe4146, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@561b6512, org.springframework.boot.test.autoconfigure.actuate.metrics.MetricsExportContextCustomizerFactory$DisableMetricExportContextCustomizer@10aa41f2, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@6ff29830, org.springframework.boot.test.context.SpringBootTestArgs@1, org.springframework.boot.test.context.SpringBootTestWebEnvironment@14bf9759], 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].
14:52:17.870 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}

不是错误 只是一些日志信息

引用 gpt 有帮助的话 采纳一下
可能的原因有:

  1. 未找到@ContextConfiguration注解或XML配置文件,无法加载上下文配置。建议添加@SpringBootTest注解加载默认配置。
  2. 未找到@Configuration注解的配置类,无法启动Spring Boot上下文。建议检查SbootZxgwptApplicationTests是否在同包或子包下有@Configuration配置类。
  3. 依赖注入失败,可能注入的bean不存在或Scope不匹配。建议检查需要注入的bean是否正确定义。
  4. 其他原因,如类路径问题、语法错误等。
    建议:
  5. 添加@SpringBootTest注解,加载默认Spring Boot测试配置。
@SpringBootTest
public class SbootZxgwptApplicationTests {

} 

  1. 检查测试类所在包及子包是否有@Configuration标注的配置类。如果没有,需要定义一个。
  2. 检查所需注入的bean是否正确定义,Scope是否匹配。
  3. 检查测试类的类路径、语法等是否正确。
  4. 可以在测试类中定义一个简单的@Test测试方法,先验证Spring Boot测试环境是否搭建成功。如:
@Test
public void contextLoads() {

}