简体   繁体   English

如何在运行 Spring Boot 应用程序时显示自动配置报告

[英]How to display auto-configuration report when running a Spring Boot application

Error starting ApplicationContext.启动 ApplicationContext 时出错。 To display the auto-configuration report re-run your application with 'debug' enabled要显示自动配置报告,请在启用“调试”的情况下重新运行您的应用程序

I am getting the above message when I try to run my Spring Boot application.当我尝试运行 Spring Boot 应用程序时收到上述消息。

Does anyone know how I can re-run the application with 'debug' enabled?有谁知道如何在启用“调试”的情况下重新运行应用程序?

I am running the application in Intellij (version 2016.1.2)我正在 Intellij 中运行该应用程序(版本 2016.1.2)

My runner class looks like the following,我的跑步者课程如下所示,

@Slf4j
@EnableIntegration
@EnableLoaderApplication
@SpringBootApplication
public class LoaderApplicaton {

    public static void main(final String[] args) {
        SpringApplication.run(LoaderApplicaton.class, args);
    }
}

In response to Darren's answer below, I amended my properties.yml file as follows and that produced the auto-configuration report,针对 Darren 在下面的回答,我修改了我的 properties.yml 文件如下,并生成了自动配置报告,

debug: true
spring:
  application:
    name: xxxMyLoaderApp
  cloud:
    config:
      uri: http://my-host.address.com:8761/config

Set debug = true or debug: true in your properties/yml.在您的属性/yml 中设置debug = truedebug: true It can also be passed as an argument --debug .它也可以作为参数传递--debug

There are further details available in the Spring Boot documentation on what the debug flag does. Spring Boot 文档中提供了有关调试标志功能的更多详细信息。

https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-logging-console-output https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-logging-console-output

In Run/Debug Configurations check "Enable debug output"在运行/调试配置中选中“启用调试输出”

在此处输入图片说明

There are lots of properties you can refer to in common-application-properties , when configuring the properties.在配置属性时,您可以在common-application-properties 中引用许多属性。

# ----------------------------------------
# CORE PROPERTIES
# ----------------------------------------
debug=false # Enable debug logs.
trace=false # Enable trace logs.

Set logging.level.org.springframework.boot.autoconfigure property to DEBUG in your application's YAML/settings file.在应用程序的 YAML/设置文件中将logging.level.org.springframework.boot.autoconfigure属性设置为DEBUG This would be enough.这样就足够了。

As I leant on it at Baeldung lecture, the debug report on autoconfigured beans displayed on Console by putting below line in "application.properties" file:正如我在 Baeldung 讲座中所了解的那样,通过将以下行放在“application.properties”文件中,控制台上显示了有关自动配置 bean 的调试报告:

logging.level.org.springframework.boot.autoconfigure=DEBUG

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM