23.1 Startup Failure(启动失败)
1 | If your application fails to start, registered FailureAnalyzers get |
如果您的应用启动失败了,注册的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 | Spring Boot provides numerous FailureAnalyzer implementations, and |
Spring Boot提供了众多的FailureAnalyzer实现,您可以加入您自身的实现。
1 | If no failure analyzers are able to handle the exception, you can |
如果没有错误分析器能够处理这个异常,依然可以展示整个的条件报告去了解到底什么出错了。这样做,您需要为以下包或者类开启debug属性或者开启DEBUG日志:org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener
1 | For instance, if you are running your application by using |
举个例子,如果您使用java -jar去运行您的应用,您能够通过开启debug属性,如下:1
$ java -jar myproject-0.0.1-SNAPSHOT.jar --debug