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

IntelliJ won't open, getting error -10810
No suitable method found for write
Force space between Panels to be 0 using BoxLayout?
Generating a checking for a magic square
Loading resources from within a static block in Swing
Search and replace with regular expressions in Java
How can I have two outputs in java but only have one show up depending on the outcome?
Organize methods for each primitives in Java
Andersen's Pointer Analysis with Soot
GraphStream: a more thorough tutorial introduction?
How to resize image to fit into imageview on gridview?
Package errors in Java
one-line swap without temp not working in Java? [duplicate]
Static method that returns a new instance?
Graphing using 2D array
JavaCV Error in Android Application

Categories

HOME
deployment
omnet++
json.net
lodash
office365api
cplex
kalman-filter
gis
google-oauth
jsrender
esper
vifm
metatrader4
row
apache-cayenne
timeout
gz
task
decimal
worldwind
systemc
foselasticabundle
custom-wordpress-pages
cx-freeze
jquery-ajaxq
orleans
kvc
kannel
fifo
preg-match
bosh
siesta-swift
ios5
xcode-extension
space-complexity
libvpx
abstract-class
eclipse-scout
avro4s
core-plot
convertapi
galleria
rainbowtable
upstart
logparser
celery-task
worker-thread
mako
specrun
pintos
yt-project
cubes
radtreelist
impresspages
bstr
superstack
yaws
qdialog
android-listview
tableau-online
splash
event-bubbling
sortedlist
oberon
angular-local-storage
key-management
kineticjs
formatjs
client-side-templating
android-radiobutton
rebol3
expected-exception
inbox
batterylevel
sabredav
wsdl-2.0
clipper
libstdc++
cisco-jtapi
dbproviderfactories
uiviewanimation-curve
transactionscope
eclipse-templates
window-management
xmlspy
ecl
yui-datatable
mysql-error-1005
icanhaz.js
getresponsestream
thread-local-storage
signal-handling

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