java


Is it possible to disable Spring Boot's autoexception handling from application.properties


Is it possible to disable Spring Boot's autoexception handling from application.properties?
I am trying to disable Spring Boots general exception handling without renaming error.html while coding and turn it on at production from application.properties.
I've found the following from Spring documentation:
At start-up, Spring Boot tries to find a mapping for /error. By
convention, a URL ending in /error maps to a logical view of the same
name: error. In the demo application this view maps in turn to the
error.html Thymeleaf template. (If using JSP, it would map to
error.jsp according to the setup of your
InternalResourceViewResolver).
If no mapping from /error to a View can be found, Spring Boot defines
its own fall-back error page - the so-called “Whitelabel Error Page”
(a minimal page with just the HTTP status information and any error
details, such as the message from an uncaught exception). If you
rename the error.html template to, say, error2.html then restart, you
will see it being used.
And also I tried the following properties which didn't work:
server.error.path=/somewrongurl
server.error.whitelabel.enabled=false
Add following lines into your application.properties file
spring.mvc.throw-exception-if-no-handler-found=true
spring.resources.add-mappings=false
And define your own Exception Controller to catch all related exceptions like
#ControllerAdvice
public class ExceptionController {
#ExceptionHandler(value = Exception.class)
public ResponseEntity<?> handleException(Exception e) {
//handle your exception
}
}

Related Links

Resizing image file rotate it horizontally android
Group a list of composite objects
Android RecyclerView scroll and position item at top
Why ArrayList doesn't implements Queue?
How to Edit Fragment Content in Android Studio?
Assigning grades to scores in an array, but keep getting incorrect grades assigned
Input/output Java example
Tests becoming very long with configurations Selenium
Selenium Webdriver drag and drop not working in chrome version 46 but works in firefox
Add sound effects at particular time in a Video file
Is Canvas onDraw timed?
Database unable to store in html format
JSON returning date in Epoch format in Spring Mvc Hibernate
Executing bash via Java process builder
How to do multiple Hibernate restrictions on a List
using LanguageTool whilst retaining HTML formatting (TinyMCE)

Categories

HOME
twitter
coq
homebrew
relative-path
cmd
jxls
echarts
autotools
cross-validation
add
awesome-wm
nano-server
izpack
google-cloud-ml
spring-tool-suite
quickfix
designer
serverless-framework
lombok
uitypeeditor
seaborn
sms-gateway
facebook-instant-articles
one-to-many
selectedindexchanged
filezilla
linkerd
social-media
maquette
large-file-upload
tasklet
bpel
overlap
appfabric
libraries
splice
gzipstream
pdf-reactor
reportingservices-2005
elmah
texmaker
bootstrap-dialog
total-commander
flickr-api
outlook-2013
youcompleteme
logparser
knockout-components
kbuild
google-perftools
namecoin
query-performance
jquery-filter
multi-level
contact-list
disque
simplewebrtc
qgraphicsview
captivenetwork
pagerank
oauth2client
independentsoft
hsv
xna-4.0
intel-fortran
teamcity-8.0
google-places
wordml
purge
emailrelay
0xdbe
deis
mono-embedding
vstest.console.exe
processmodel
cisco-ios
oberon
modalpopup
xc16
winddk
eol
sgen
android-2.2-froyo
srs
centos5
fmod
jsctypes
dexterity
tidy
jmapviewer
dataservice
ora-00911
eventual-consistency
xamlparseexception
appconkit
ohm
psi
xmlspy
hamachi
invite
celltable
google-friend-connect
web-architecture
sef
.net-1.0
windows-live-messenger
ajax-forms

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App