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

Edge Detection Algorithm with Processing (Java)
Spring boot web app not working on Tomcat - 404 error
Creating multiple aliases for the same QueryDSL path in Spring Data
Pythagoras tree in Java: How do I calculate the third point of the triangle?
Not able to fetch gerrit created date of review
Scope for a local variable in FOR LOOP in java
Download files in the background and show progress in an android Fragment
java.lang.ArrayIndexOutOfBoundsException: 11 facing this error with the below code [duplicate]
Can't save entity with composite key
Cassandra query on timestamp column returns no values with Java's Instant type
Apache HTTP Client and conditional setting of proxy
How to preserve class type when passing object between Struts actions?
ByteBuddy - Rebasing native methods
LibGDX: The relationship between Screen interface and Game class
Converting a Cloud Storage file into a BigQuery Table/Dataset to then later query
Howto make the withdraw stop when the balance below 25$

Categories

HOME
osgi
gitlab
openstack
activiti
azure-data-factory
path-finding
react-virtualized
android-4.4-kitkat
analysis
ezpublish
django-imagekit
adfs
gitpitch
primary-key
communication
google-cloud-ml
dtrace
ibm-odm
clojurescript
opentracing
sms-gateway
code-review
custom-wordpress-pages
nas
dcevm
crystal-reports-2010
cas
spring-mybatis
tasklet
unboundid
instant-messaging
galsim
functor
oracle-fusion-middleware
catch-all
hybridauth
azure-sql-database
form-data
html5-fullscreen
vxworks
main
espeak
opshub
trim
ncalc
ibpy
midl
turbogears
vao
strptime
pango
ionicons
query-performance
medium.com
wdf
firmata
grails-tomcat-plugin
vmware-tools
bonobo
holder.js
wapiti
historian
purge
mmc
notify
system.reflection
oxwall
tablelayout
starcluster
aapt
didselectrowatindexpath
pyhdf
quantlib-swig
xamlparseexception
comaddin
cassini-dev
chuck
rdoc
cisco-jtapi
wse3.0
php-parser
radcombobox
castle-monorail
perfect-hash
firefox-5
photoshop-cs4
avatar

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