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

Using ObservaleList to add element into ListView
find all items where a list field contains a value in dynamodb
is there any java/spring way to store session information for the current logged user using the HttpServletRequest?
How to auto generate a primary key using Hibernate and an H2 database [duplicate]
How do I save Java log messages to a file like my Rails log messages?
How to keyDown SHIFT + “w” while clicking - selenium java
Restoring alarms makes app crash
spring boot oauth2 with jdbc token store gives oauth_access_token relation doesn't exist
How do I not update the Ref'ed object?
createStoredProcedureQuery is not resolved
Pass generic type parameter class as argument
How to Create HMAC in javascript
Android - update toolbar title in activity while handle back navigation with fragment
Unable to create /.oauth-credentials directory
send audio to speakers and headphone
How to preserve GTK look & feel in Java using sudo

Categories

HOME
keras
tizen
maven-3
retrofit
cross-browser
pivotal-cloud-foundry
qt-creator
vb.net-2010
remote-access
decomposition
worldwind
highlight.js
transformation
google-static-maps
invantive-sql
solaris-10
jprofiler
zurb-foundation-6
devops
format-specifiers
autosys
h2db
sparse-matrix
url-scheme
fifo
subdomains
siesta-swift
noraui
mozilla
git-merge
lto
splice
tasker
ruby-on-rails-3.1
nand2tetris
arena-simulation
heightmap
angular2-meteor
logfiles
menuitem
paxos
nsarray
boost-preprocessor
windows-mobile-6.5
r-forge
mako
httplistener
login-control
bgp
fadeout
lemon
thredds
cyclomatic-complexity
wireshark-dissector
varargs
cakephp-3.1
service-accounts
apache-commons-fileupload
iiviewdeckcontroller
javax.mail
geonetwork
system.reflection
preferences
php-5.4
uitouch
reactfx
poller
resty-gwt
aqtime
apc
opcache
yui-compressor
xamlparseexception
factory-method
bluepill
frameset
nsmanagedobject
semantic-diff
doh
lpeg
yslow
sudzc
subviews
backcolor
privilege
text-coloring
scripting-languages
wsdl.exe

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