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

Applet php communication using POST
Change current working directory for each module in a reactor build?
How do i replace “\” with “\” [duplicate]
How to automatically expand a a4j:outputPanel?
Why is calling a function faster than not calling a function?
How make sure that singleton message driven bean processes one message at a time?
Write a program that prompts user to enter two points (work included)
overriding equals method problems
Android Google Maps Fatal Exception
Recursive statement calling another Recursive statement?
Hibernate/JPA : Include field in where clause of update
Java - Execute SQL queries only once
Convertings mills to hh mm ss [closed]
Java - Product of rows only and full 2d array
why does recursion do this? [closed]
Maximum language.properties file size in liferay custom portlets

Categories

HOME
maven
arduino-uno
clips
keycloak
office365api
objectgears
sd-card
spagobi
razor
spring-cloud-stream
youtube-api-v3
cakephp-2.5
windows-server
azure-media-services
slick-slider
numeral.js
collectd
gz
iron-router
saxon
windows-7-x64
database-replication
oracle-coherence
interop
openedx
jprofiler
physics-engine
devops
firebase-crash-reporting
opennlp
filezilla
lightswitch-2013
nameservers
uisplitview
create-table
lxd
gammu
bytecode-manipulation
espeak
starteam
twitch
elasticsearch-plugin
android-tabhost
mapzen
sfdc
nomethoderror
estimote
mime
netcdf4
apple-news
angular-resource
scrollable
pango
prolog-setof
ionicons
recursive-datastructures
python-cryptography
static-ip-address
bonobo
underscore.js-templating
merge-conflict-resolution
contact-list
python-stackless
rhino-servicebus
netmq
cyclomatic-complexity
metaclass
wordml
fouc
javax.mail
modalpopup
eol
xceed-datagrid
mechanize-ruby
cloud-connect
flexmojos
pushbackinputstream
xamlparseexception
limejs
gil
online-compilation
netbeans-6.9
nsdatecomponents
gwt-ext
vdsp
gcj
xmemcached
self-extracting
celltable
mongomapper
suppress
ext3
castle-monorail
mtj
noscript

Resources

Encrypt Message