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

Jersey Async ContainerRequestFilter
Adding ActionListener to button
how to dynamically set the “value” attribute of url tag in struts2?
Spring 4 binaries download
Application crashing on calling a JNI modal dialog box
Spring integration tests with profile
Bufferedreader blocks thread but adding in if(br.ready()) stops disconnect check
Remove/Find Nodes in hierarchical table of JPA Hibernate
live wallpaper, frame animation, lags
DB2 installation error while installing portlet server
Generate different sequence Ids per child entity table - Java/Hibernate
gettting nullpointerexception while adding resources in arquillian
Hibernate Lazy Load and #Transient
import large data into a 2d array
BeanCreationException in spring controller
How to tag field specific nouns using Parts-of-Speech Taggers?

Categories

HOME
compiler-construction
clips
deployment
debugging
c#-4.0
pycharm
reserved
react-virtualized
icloud
datastax-java-driver
azure-media-services
bs4
vifm
imacros
qt-creator
windows-azure-storage
size
dosgi
pugjs
solaris-10
code-review
oxyplot
karma-jasmine
amazonsellercentral
scriptcs
physics-engine
extjs5
icloud-api
crosstab
dynamic-featured-image
pingfederate
uninstall
ejabberd-module
webkitspeechrecognition
vision
unboundid
nouislider
frame
uisplitview
stringtemplate
http-referer
jquery-bootgrid
swisscomdev
twitch
theano.scan
elmah
eigenvalue
strptime
python-webbrowser
ionicons
mu
jxcore
magma
akka-cluster
spring-cache
lync-client-sdk
objective-c-swift-bridge
sts-springsourcetoolsuite
elements
websitepanel
javax.sound.midi
ios8-today-widget
separator
r-tree
sdhc
cyclomatic-complexity
citrus-pay
quicklisp
twirl
sysinternals
ami
system32
proj4js
typekit
android-imagebutton
mesa
fmod
dir
blending
random-seed
lcs
android-hardware
free-variable
itmstransporter
frameset
armcc
enter
pydot
doh
joyent
dentrix
javap
boost-smart-ptr
premature-optimization
grid-system

Resources

Encrypt Message