Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
6f70d532
Commit
6f70d532
authored
Sep 02, 2016
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add documentation for `FailureAnalyzer`
Closes gh-6775
parent
0e00a49d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
0 deletions
+47
-0
howto.adoc
spring-boot-docs/src/main/asciidoc/howto.adoc
+24
-0
spring-boot-features.adoc
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+23
-0
No files found.
spring-boot-docs/src/main/asciidoc/howto.adoc
View file @
6f70d532
...
...
@@ -22,6 +22,30 @@ can send us a {github-code}[pull request].
== Spring Boot application
[[howto-failure-analyzer]]
=== Create your own FailureAnalyzer
{dc-spring-boot}/diagnostics/FailureAnalyzer.{dc-ext}[[`FailureAnalyzer`] is a great way
to intercept an exception on startup and turn it into a human-readable message, wrapped
into a {dc-spring-boot}/diagnostics/FailureAnalysis.{dc-ext}[[`FailureAnalysis`]. Spring
Boot provides such analyzer for application context related exceptions, JSR-303
validations and more. It is actually very easy to create your own.
`AbstractFailureAnalyzer` is a convenient extension of `FailureAnalyzer` that checks the
presence of a specified exception type in the exception to handle. You can extend from
that so that your implementation gets a chance to handle the exception only when it is
actually present. If for whatever reason you can't handle the exception, return `null`
to let another implementation a chance to handle the exception.
`FailureAnalyzer` implementations are to be registered in a `META-INF/spring.factories`:
the following registers `ProjectConstraintViolationFailureAnalyzer`:
[source,properties,indent=0]
----
org.springframework.boot.diagnostics.FailureAnalyzer=\
com.example.ProjectConstraintViolationFailureAnalyzer
----
[[howto-troubleshoot-auto-configuration]]
=== Troubleshoot auto-configuration
...
...
spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
View file @
6f70d532
...
...
@@ -46,6 +46,29 @@ When your application starts you should see something similar to the following:
By default `INFO` logging messages will be shown, including some relevant startup details
such as the user that launched the application.
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:
[indent=0]
----
***************************
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.
----
NOTE: Spring Boot provides numerous `FailureAnalyzer` implementations and you can
<<howto.adoc#howto-failure-analyzer,add your own>> very easily.
[[boot-features-banner]]
=== Customizing the Banner
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment