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

Errors in running a .sh file using Eclipse Neon
Create Excel.xlsx files with POI Apache with embeded clickable images
Picketlink: finding users with given role
How to reset a neo4j database if neo4j is used over java?
Download image from Mysql with url to custom listview
can't install new apache geronimo server in eclipse windows
Retrofit request body: Required fields
getIntrinsicWidth() or getIntrinsicHeight() gives wrong sizes when dpi is modified
BIRT report download as PDF doesn't contain the data
How to get the description string from the forecast weather array from the openweathermap API?
Sin approximation using Maclaurin expansion
How to pass string variable from java class in an android activity to a php file?
android ionic - build cordova plugin for putting app in devices services
Jaxb unmarshal XML elements having composite fields
Converting an integer to binary using old-school way
how to copy a hexstring to hexint or hexlong in java?

Categories

HOME
sendgrid
debugging
push-notification
syntax
read-eval-print-loop
framework7
paw-app
microservices
umd
baqend
ravendb
upload
awesome-wm
ssl-client-authentication
clojurescript
foselasticabundle
openrefine
interop
introduction
reverse-proxy
dcevm
autosys
icloud-api
opennlp
underflow
brunch
maxmind
vision
uisplitview
exuberant-ctags
karaf
perlin-noise
repo
textmate
xmlreader
form-data
geopositioning
html5-fullscreen
wixsharp
devextreme
vxworks
simplexml
swisscomdev
hilbert-curve
unobtrusive-validation
lumberjack
texmaker
arena-simulation
no-www
turbogears
flashair
s
businessworks
scorm
skeleton-css-boilerplate
integrity
google-perftools
capacity
sonarlint-vs
orthogonal
cubes
setuptools
storekit
qpid
sigabrt
hill-climbing
make-install
livequery
wapiti
metaclass
qdialog
mutation-observers
wireshark-dissector
iis-arr
unity3d-gui
e10s
zend-route
cloud-connect
tws
xamlparseexception
plasma
pygit2
eventlistener
drools-planner
http-unit
angularjs-controller
anonymous-methods
isnullorempty
trusted
nsnetservice
first-responder
dsn
tridion-worldserver
appconkit
ticoredatasync
hgsubversion
gcj
genshi
tomcat-valve
mongomapper
mysql-error-1005
lang
.nettiers
getresponsestream
perfect-hash
kdbg
virtual-functions
privilege
pascal-fc
sector
port-number
caching-application-block

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