SpringBoot官方文档翻译(三十):启动失败

23.1 Startup Failure(启动失败)

1
2
3
4
5
If your application fails to start, registered FailureAnalyzers get     
a chance to provide a dedicated error message and a concrete action
to fix the problem. For instance, if you start a web application on
port 8080 and that port is already in use, you should see something
similar to the following message:

如果您的应用启动失败了,注册的FailureAnalyzers将获得有机会提供专门的错误信息和具体行动
解决问题。举个例子,如果您子啊端口8080启动一个应用,而此端口已经被使用了,将会出现如下信息:

1
2
3
4
5
6
7
8
9
10
11
***************************
APPLICATION FAILED TO START
***************************

Description:

Embedded servlet container failed to start. Port 8080 was already in use.

Action:

Identify and stop the process that's listening on port 8080 or configure this application to listen on another port.

1
2
Spring Boot provides numerous FailureAnalyzer implementations, and     
you can add your own.

Spring Boot提供了众多的FailureAnalyzer实现,您可以加入您自身的实现。

1
2
3
4
If no failure analyzers are able to handle the exception, you can     
still display the full conditions report to better understand what
went wrong. To do so, you need to enable the debug property or enable DEBUG logging for
org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener.

如果没有错误分析器能够处理这个异常,依然可以展示整个的条件报告去了解到底什么出错了。这样做,您需要为以下包或者类开启debug属性或者开启DEBUG日志:org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener

1
2
For instance, if you are running your application by using     
java -jar, you can enable the debug property as follows:

举个例子,如果您使用java -jar去运行您的应用,您能够通过开启debug属性,如下:

1
$ java -jar myproject-0.0.1-SNAPSHOT.jar --debug

分享到