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

How do I include a UNIX timestamp in a rolled log filename with log4j2?
hibernate orm - how to properly specify a composite primary ket to session.get?
Java, zoom operations for raster and vector data
Android call public method on Fragment added in XML
menu not created when fragment is created but works on resume
Amazon Java SDK - Upload to S3
Is it possible to deploy GAE static files without deploying the dynamic code?
querydsl - list condition
android.content.res.Resources$NotFoundException: Resource ID #0x0
Import multiple libraries in makefile within Javac command
Cannot start WicketTester
Save ArrayList that contains duplicate values with SharedPreferences
Does RestTemplate automatically release connection?
GAE Objectify load object created in transaction within same transaction
Reload/Change UserDetails in Spring for Extra Information
Java parse String to Object's List [duplicate]

Categories

HOME
client
jdo
debugging
tinymce
smarty
maven-3
malloc
survey
ezpublish
android-youtube-api
webrequest
synchronization
elasticsearch-hadoop
primary-key
kibana-4
modx-revolution
jplayer
iolanguage
openrefine
google-static-maps
autocad-plugin
functional-testing
mmap
claims-based-identity
su
kannel
phpfox
minitab
opentype
facebook-apps
windowbuilder
c++-amp
quote
bpel
yadcf
siesta-swift
karaf
avcapturesession
io-redirection
simplexml
git-merge
x11-forwarding
quadratic-programming
fakeiteasy
outlook-api
import-from-excel
jquery-validate
pnotify
python-webbrowser
nstextview
brightcove
jxcore
nodebb
spring-cache
medium.com
firmata
color-picker
google-feed-api
libpng
nsfilemanager
merge-conflict-resolution
paypal-express
markojs
react-native-listview
hexdump
ios4
separator
quicklisp
computer-algebra-systems
wyam
ios9.1
interrupted-exception
vstest.console.exe
dia
nstableviewcell
angularjs-ng-click
asp.net-dynamic-data
nsbutton
asp.net-web-api-odata
rtmfp
meteor-velocity
flash-builder4.5
ora-00911
eclipse-memory-analyzer
shellexecute
flashvars
free-variable
isnullorempty
first-responder
dsn
osql
hamachi
iphone-web-app
mongomapper
lpeg
.nettiers
vc90
castle-monorail
sustainable-pace
genealogy
paul-graham
document-conversion

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