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

Q: Selenium Stopped Working After Working Previously
org.hibernate.MappingException: No Dialect mapping for JDBC type: 2002 when I'm trying to sorted FullTextSearching select
Save latitude/longitude into variable
How to click on an element before the page is fully loaded i'm stuck, it takes too much time until loading completed
Can't get return values from methods ( java)
Implementing a Circular Queue using an ArrayList
Findbugs is generating different error count for different engines
Why is that get 0.8999999999999999 as the output of System.out.println(0.3+0.6) in Java? [duplicate]
Java - Storing numbers from input file in a 2D array
How to make a seamless picture repeat itself after scrolling down in Java?
Jpa subselect error
Play several mp3 files in one Onclick statement?
Simplest way to validate java user input on array
NatTable - Percentage Sizing with Column hiding
Netbeans in Ubuntu - Click in “New Project” and nothing happens
weblogic cluster eclipse target

Categories

HOME
wso2-am
listview
gremlin
session
xmpp
rdf
ojdbc
iggrid
session-variables
nano-server
user-input
spring-kafka
google-apps-marketplace
google-cloud-ml
jsprit
netflix
serverless-framework
libtiff
invantive-sql
flux
google-pagespeed
introduction
dbext
jtextfield
dcevm
language-agnostic
format-specifiers
crosstab
xpages-ssjs
vlsi
poltergeist
kannel
fgetcsv
fifo
google-cloud-nl
javascriptcore
.net-4.0
jspresso
fog
column-family
avcapturesession
http-referer
force-layout
html5-fullscreen
scaffold
swisscomdev
automake
hot-module-replacement
gesture
starteam
graphenedb
glew
android-mediaprojection
bootstrap-dialog
btrace
google-datalayer
termination
alphabet
setter
sybase-asa
spring-mongodb
android-fonts
transmitfile
jwplayer7
react-native-listview
actionbardrawertoggle
essence
rhino-servicebus
revolution-r
lib.web.mvc
icu4j
jmeter-maven-plugin
android-listview
riak-cs
processmodel
system32
directoryservices
codeigniter-url
network-interface
android-imagebutton
javafx-webengine
codeigniter-routing
article
seaside
srs
industrial
floating-point-precision
access-rights
google-cloud-save
gridcontrol
eventual-consistency
sqlperformance
robotics-studio
mhtml
cascalog
dbproviderfactories
punbb
netdna-api
zpt
genshi
infobox
locationlistener
infrastructure
xsdobjectgen
asp.net-profiles
vc90
audio-capture
iweb
grid-system

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